Skip to content

Commit

Permalink
Add SLAMS Actionbar and Tablist
Browse files Browse the repository at this point in the history
  • Loading branch information
Almighty-Satan committed Dec 7, 2024
1 parent 73c6da8 commit 0742d1c
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 298 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void onCommand(CommandSender sender, VaroPlayer vp, Command cmd, String l
return;
}

if (!ConfigSetting.ACTIONBAR.getValueAsBoolean() || vp.getActionbar() == null) {
if (!ConfigSetting.ACTIONBAR_ENABLED.getValueAsBoolean() || vp.getActionbar() == null) {
sender.sendMessage(Main.getPrefix() + ConfigMessages.VARO_COMMANDS_ACTIONBAR_DEACTIVATED.getValue(vp));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void onCommand(CommandSender sender, VaroPlayer vp, Command cmd, String l
return;
}

if (!ConfigSetting.SCOREBOARD.getValueAsBoolean() || vp.getScoreboard() == null) {
if (!ConfigSetting.SCOREBOARD_ENABLED.getValueAsBoolean() || vp.getScoreboard() == null) {
sender.sendMessage(Main.getPrefix() + ConfigMessages.VARO_COMMANDS_SCOREBOARD_DEACTIVATED.getValue(vp));
return;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/de/cuuky/varo/config/language/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public final class Messages {

public static final VaroMessageArray PLAYER_SCOREBOARD_TITLE = array("player.scoreboard.title");
public static final VaroMessageArray2d PLAYER_SCOREBOARD_CONTENT = array2d("player.scoreboard.content");
public static final VaroMessageArray PLAYER_ACTIONBAR = array("player.actionbar");
public static final VaroMessageArray2d PLAYER_TABLIST_HEADER = array2d("player.tablist.header");
public static final VaroMessageArray2d PLAYER_TABLIST_FOOTER = array2d("player.tablist.footer");

public static final VaroMessage FINALE_START_FREEZE = message("finale.start.freeze");
public static final VaroMessage FINALE_START_NOFREEZE = message("finale.start.noFreeze");
Expand Down
36 changes: 19 additions & 17 deletions src/main/java/de/cuuky/varo/config/language/Placeholders.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,25 @@ static PlaceholderResolver getPlaceholders() {
}

private static void addPlayerPlaceholders(PlaceholderResolver.Builder builder) {
builder.contextual("name", PlayerContext.class, (ctx) -> ctx.getPlayer().getName());
builder.contextual("uuid", PlayerContext.class, (ctx) -> ctx.getPlayer().getUUID());
builder.contextual("id", PlayerContext.class, (ctx) -> String.valueOf(ctx.getPlayer().getId()));
builder.contextual("prefix", PlayerContext.class, (ctx) -> ctx.getPlayer().getPrefix());
builder.contextual("team", PlayerContext.class, (ctx) -> ctx.getPlayer().getTeam() != null ? ctx.getPlayer().getTeam().getDisplay() : "-");
builder.contextual("team-id", PlayerContext.class, (ctx) -> ctx.getPlayer().getTeam() != null ? String.valueOf(ctx.getPlayer().getTeam().getId()) : "-");
builder.contextual("rank", PlayerContext.class, (ctx) -> ctx.getPlayer().getRank() != null ? ctx.getPlayer().getRank().getDisplay() : "-");
builder.contextual("kills", PlayerContext.class, (ctx) -> String.valueOf(ctx.getPlayer().getStats().getKills()));
builder.contextual("strikes", PlayerContext.class, (ctx) -> String.valueOf(ctx.getPlayer().getStats().getStrikes().size()));
builder.contextual("countdown-hour", PlayerContext.class, (ctx) -> !Main.getVaroGame().isPlayTimeLimited() ? "-" : String.format("%02d", ctx.getPlayer().getStats().getCountdown() / 3600));
builder.contextual("countdown-minute", PlayerContext.class, (ctx) -> !Main.getVaroGame().isPlayTimeLimited() ? "-" : String.format("%02d", (ctx.getPlayer().getStats().getCountdown() / 60) % 60));
builder.contextual("countdown-second", PlayerContext.class, (ctx) -> !Main.getVaroGame().isPlayTimeLimited() ? "-" : String.format("%02d", ctx.getPlayer().getStats().getCountdown() % 60));
builder.namespace(null, PlayerContext.class, PlayerContext::toOnlinePlayerContext, onlineBuilder -> {
onlineBuilder.contextual("x", OnlinePlayerContext.class, ctx -> String.valueOf(ctx.getPlayer().getLocation().getBlockX()));
onlineBuilder.contextual("y", OnlinePlayerContext.class, ctx -> String.valueOf(ctx.getPlayer().getLocation().getBlockY()));
onlineBuilder.contextual("z", OnlinePlayerContext.class, ctx -> String.valueOf(ctx.getPlayer().getLocation().getBlockZ()));
onlineBuilder.contextual("world", OnlinePlayerContext.class, ctx -> ctx.getPlayer().getLocation().getWorld().getName());
builder.contextual("name", PlayerContext.class, (ctx) -> ctx.getPlayer().getName())
.contextual("uuid", PlayerContext.class, (ctx) -> ctx.getPlayer().getUUID())
.contextual("id", PlayerContext.class, (ctx) -> String.valueOf(ctx.getPlayer().getId()))
.contextual("prefix", PlayerContext.class, (ctx) -> ctx.getPlayer().getPrefix())
.contextual("team", PlayerContext.class, (ctx) -> ctx.getPlayer().getTeam() != null ? ctx.getPlayer().getTeam().getDisplay() : "-")
.contextual("team-id", PlayerContext.class, (ctx) -> ctx.getPlayer().getTeam() != null ? String.valueOf(ctx.getPlayer().getTeam().getId()) : "-")
.contextual("rank", PlayerContext.class, (ctx) -> ctx.getPlayer().getRank() != null ? ctx.getPlayer().getRank().getDisplay() : "-")
.contextual("kills", PlayerContext.class, (ctx) -> String.valueOf(ctx.getPlayer().getStats().getKills()))
.contextual("strikes", PlayerContext.class, (ctx) -> String.valueOf(ctx.getPlayer().getStats().getStrikes().size()))
.contextual("countdown-hour", PlayerContext.class, (ctx) -> !Main.getVaroGame().isPlayTimeLimited() ? "-" : String.format("%02d", ctx.getPlayer().getStats().getCountdown() / 3600))
.contextual("countdown-minute", PlayerContext.class, (ctx) -> !Main.getVaroGame().isPlayTimeLimited() ? "-" : String.format("%02d", (ctx.getPlayer().getStats().getCountdown() / 60) % 60))
.contextual("countdown-second", PlayerContext.class, (ctx) -> !Main.getVaroGame().isPlayTimeLimited() ? "-" : String.format("%02d", ctx.getPlayer().getStats().getCountdown() % 60))

.namespace(null, PlayerContext.class, PlayerContext::toOnlinePlayerContext, onlineBuilder -> {
onlineBuilder.contextual("x", OnlinePlayerContext.class, ctx -> String.valueOf(ctx.getPlayer().getLocation().getBlockX()))
.contextual("y", OnlinePlayerContext.class, ctx -> String.valueOf(ctx.getPlayer().getLocation().getBlockY()))
.contextual("z", OnlinePlayerContext.class, ctx -> String.valueOf(ctx.getPlayer().getLocation().getBlockZ()))
.contextual("world", OnlinePlayerContext.class, ctx -> ctx.getPlayer().getLocation().getWorld().getName())
.contextual("distance-to-border", OnlinePlayerContext.class, ctx -> String.valueOf((int) Main.getVaroGame().getVaroWorldHandler().getVaroWorld(ctx.getPlayer().getWorld()).getVaroBorder().getDistance(ctx.getPlayer())));
});
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ public enum ConfigSetting implements SectionEntry {
MINIMAL_SPECTATOR_HEIGHT(ConfigSettingSection.OTHER, "minimalSpectatorHeight", 70, "Wie tief die Spectator maximal fliegen koennen.\nOff = 0"),
SPECTATOR_CHAT(ConfigSettingSection.OTHER, "spectatorChat", false, "Ob Spectator in den Chat schreiben können"),

NAMETAGS_ENABLED(ConfigSettingSection.MAIN, "nametags.enabled", true, "Ob das Plugin die Nametags ueber\nden Koepfen der Spieler veraendern soll.\nHinweis: du kannst diese in den Language-Dateien einstellen.", true),
NAMETAGS_VISIBLE_DEFAULT(ConfigSettingSection.MAIN, "nametags.visible.default", true, "Ob NameTags sichtbar sein sollen"),
NAMETAGS_VISIBLE_TEAM(ConfigSettingSection.MAIN, "nametags.visible.team", true, "Ob NameTags für das eigene Team sichtbar sein sollen\nwenn nametags.visible.default deaktiviert ist"),
NAMETAGS_VISIBLE_SPECTATOR(ConfigSettingSection.MAIN, "nametags.visible.spectator", true, "Ob NameTags für Spectator sichtbar sein sollen\nwenn nametags.visible.default deaktiviert ist"),

NO_ACTIVITY_DAYS(ConfigSettingSection.ACTIVITY, "noActivityDays", -1, "Nach wie vielen Tagen ohne Aktiviaet auf dem\nServer der Spieler gemeldet werden soll.\nOff = -1"),

NO_KICK_DISTANCE(ConfigSettingSection.OTHER, "noKickDistance", 30, "In welcher Distanz zum Gegner\nein Spieler nicht gekickt wird.\nOff = 0"),
Expand Down Expand Up @@ -230,8 +225,6 @@ public enum ConfigSetting implements SectionEntry {
RESET_SESSION_HOUR(ConfigSettingSection.MAIN, "resetSessionHour", 1, "Um welche Uhrzeit (24h) der Server den\nSpieler neue Sessions etc. gibt"),

RESPAWN_PROTECTION(ConfigSettingSection.DEATH, "respawnProtection", 120, "Wie lange in Sekunden Spieler\nnach Respawn geschuetzt sind"),
SCOREBOARD(ConfigSettingSection.MAIN, "scoreboard", true, "Ob das Scoreboard aktiviert sein soll.\nHinweis: das Scoreboard kannst du in\nder scoreboard.yml bearbeiten.", true),
ACTIONBAR(ConfigSettingSection.MAIN, "actionbar", true, "Ob die Actionbar aktiviert sein soll.\nHinweis: die Actionbar kannst du in\nder actionbar.yml bearbeiten.", true),
SESSIONS_PER_DAY(ConfigSettingSection.JOIN_SYSTEMS, "sessionsPerDay", 1, "ERSTES JOIN SYSTEM\nStellt ein, wie oft Spieler am Tag\nden Server regulaer betreten duerfen."),

NAMETAGS_OVER_SPAWN(ConfigSettingSection.WORLD, "setNameTagOverSpawn", true, "Ob Nametags ueber den\nSpawns erscheinen sollen"),
Expand Down Expand Up @@ -299,11 +292,22 @@ public enum ConfigSetting implements SectionEntry {
// CUSTOM COMMAND
CUSTOMCOMMAND_USEPREFIX(ConfigSettingSection.OTHER, "customCommandUsePrefix", true, "Ob bei allen Custom Commands automatisch\nder Prefix genutzt werden soll."),

// TABLIST
TABLIST(ConfigSettingSection.TABLIST, "tablist", true, "Ob das Plugin die Tablist modfizieren soll\nMuss aktiviert sein, um folgende Einstellungen\nvorzunehmen.", true),
TABLIST_USE_HEADER(ConfigSettingSection.TABLIST, "useHeader", true, "Ob die Tablist einen Header haben soll.\nErfordert config reload und ggf. rejoin."),
TABLIST_USE_FOOTER(ConfigSettingSection.TABLIST, "useFooter", true, "Ob die Tablist einen Footer haben soll.\nErfordert config reload und ggf. rejoin."), // enable: config reload
TABLIST_CHANGE_NAMES(ConfigSettingSection.TABLIST, "changeNames", true, "Ob die Namen in der Tablist modfiziert werden sollen."),
// HUD
TABLIST_ENABLED(ConfigSettingSection.HUD, "tablist.enabled", true, "Ob das Plugin die Tablist modfizieren soll\nMuss aktiviert sein, um folgende Einstellungen\nvorzunehmen.", true),
TABLIST_HEADER_ENABLED(ConfigSettingSection.HUD, "tablist.header.enabled", true, "Ob die Tablist einen Header haben soll.\nErfordert config reload und ggf. rejoin."),
TABLIST_HEADER_UPDATEDELAY(ConfigSettingSection.HUD, "tablist.header.updatedelay", 10, "Das Intervall in Ticks mit dem der Header der Tablist aktualisiert werden soll."),
TABLIST_FOOTER_ENABLED(ConfigSettingSection.HUD, "tablist.footer.enabled", true, "Ob die Tablist einen Footer haben soll.\nErfordert config reload und ggf. rejoin."), // enable: config reload
TABLIST_FOOTER_UPDATEDELAY(ConfigSettingSection.HUD, "tablist.footer.updatedelay", 0, "Das Intervall in Ticks mit dem der Footer der Tablist aktualisiert werden soll."),
TABLIST_CHANGE_NAMES(ConfigSettingSection.HUD, "tablist.changeNames", true, "Ob die Namen in der Tablist modfiziert werden sollen."),
NAMETAGS_ENABLED(ConfigSettingSection.HUD, "nametags.enabled", true, "Ob das Plugin die Nametags ueber\nden Koepfen der Spieler veraendern soll.\nHinweis: du kannst diese in den Language-Dateien einstellen.", true),
NAMETAGS_VISIBLE_DEFAULT(ConfigSettingSection.HUD, "nametags.visible.default", true, "Ob NameTags sichtbar sein sollen"),
NAMETAGS_VISIBLE_TEAM(ConfigSettingSection.HUD, "nametags.visible.team", true, "Ob NameTags für das eigene Team sichtbar sein sollen\nwenn nametags.visible.default deaktiviert ist"),
NAMETAGS_VISIBLE_SPECTATOR(ConfigSettingSection.HUD, "nametags.visible.spectator", true, "Ob NameTags für Spectator sichtbar sein sollen\nwenn nametags.visible.default deaktiviert ist"),
SCOREBOARD_ENABLED(ConfigSettingSection.HUD, "scoreboard.enabled", true, "Ob das Scoreboard aktiviert sein soll.\nHinweis: das Scoreboard kannst du in\nder Language-Datei bearbeiten.", true),
SCOREBOARD_TITLE_UPDATEDELAY(ConfigSettingSection.HUD, "scoreboard.title.updatedelay", 0, "Das Intervall in Ticks in mit dem der Titel des Scoreboards aktualisiert werden soll."),
SCOREBOARD_BODY_UPDATEDELAY(ConfigSettingSection.HUD, "scoreboard.body.updatedelay", 100, "Das Intervall in Ticks mit dem das Scoreboards aktualisiert werden soll."),
ACTIONBAR_ENABLED(ConfigSettingSection.HUD, "actionbar.enabled", true, "Ob die Actionbar aktiviert sein soll.\nHinweis: die Actionbar kannst du in\nder Language-Datei bearbeiten.", true),
ACTIONBAR_UPDATEDELAY(ConfigSettingSection.HUD, "actionbar.updatedelay", 100, "Das Intervall in Ticks mit dem die Actionbar aktualisiert werden soll."),

// COMMANDS
COMMAND_ANTIXRAY_ENABLED(ConfigSettingSection.COMMANDS, "antixray.enabled", true, "Ob /antixray aktiviert sein soll"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum ConfigSettingSection implements SectionConfiguration {
DISCONNECT("Disconnect", XMaterial.COAL, "Hier kannst du einstellen, was passiert,\nwenn ein Spieler zu frueh disconnected."),
DISCORD("Discord", XMaterial.DISPENSER, "Hier kannst du Einstellungen zum DiscordBot vornehmen."),
FINALE("Finale", XMaterial.END_PORTAL_FRAME, "Hier kannst du Einstellungen zum Finale des Projektes vornehmen."),
HUD("HUD", XMaterial.PAINTING, "Hier kannst du Einstellungen zur HUD vornehmen."),
INTRO("Intro", XMaterial.FIREWORK_ROCKET, "Hier kannst du Einstellungen zum Intro vornehmen."),
JOIN_SYSTEMS("JoinSystems", XMaterial.RED_BED, "Hier kannst du einstellen, wann und wie oft Spieler joinen duerfen."),
MAIN("Main", XMaterial.LEVER, "Hier kannst du alle Haupteinstellungen vornehmen."),
Expand All @@ -34,7 +35,6 @@ public enum ConfigSettingSection implements SectionConfiguration {
SERVER_LIST("Serverlist", XMaterial.OAK_SIGN, "Hier kannst du die Anzeige des Servers in der Serverliste konfigurieren."),
START("Start", XMaterial.ACTIVATOR_RAIL, "Hier kannst du Einstellungen zum Start deines Plugins vornehmen."),
STRIKE("Strike", XMaterial.PAPER, "Hier kannst du Einstellungen zu den Strikes vornehmen."),
TABLIST("TablistSettings", XMaterial.PAINTING, "Hier kannst du Einstellungen zur Tablist vornehmen."),
TEAMS("Teams", XMaterial.DIAMOND_HELMET, "Hier kannst du Einstellungen zu Teams vornehmen."),
TELEGRAM("Telegram", XMaterial.DROPPER, "Alle Einstellungen zum Telegram-Bot."),
WORLD("World", XMaterial.GRASS_BLOCK, "Hier kannst du Einstellungen zur Welt vornehmen."),
Expand Down

This file was deleted.

Loading

0 comments on commit 0742d1c

Please sign in to comment.