Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei1058 committed Jul 23, 2023
1 parent 6e75c0f commit f7736fe
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class ConfigManager {
*/
public ConfigManager(Plugin plugin, String name, String dir) {
File d = new File(dir);

if (!d.exists()) {
if (!d.mkdirs()) {
plugin.getLogger().log(Level.SEVERE, "Could not create " + d.getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public class ConfigPath {
public static final String SB_CONFIG_SIDEBAR_LIST_REFRESH = "scoreboard-settings.player-list.names-refresh-interval";
public static final String SB_CONFIG_SIDEBAR_HEALTH_IN_TAB = "scoreboard-settings.health.display-in-tab";
public static final String SB_CONFIG_SIDEBAR_HEALTH_REFRESH = "scoreboard-settings.health.animation-refresh-interval";

public static final String SB_CONFIG_TAB_HEADER_FOOTER_ENABLE = "scoreboard-settings.tab-header-footer.enable";
public static final String SB_CONFIG_TAB_HEADER_FOOTER_REFRESH_INTERVAL = "scoreboard-settings.tab-header-footer.refresh-interval";

public static final String GENERAL_CONFIGURATION_DISABLED_LANGUAGES = "disabled-languages";

public static final String GENERAL_CONFIGURATION_ARENA_SELECTOR_PATH = "arena-gui";
Expand Down
18 changes: 9 additions & 9 deletions bedwars-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,55 +242,55 @@
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-base</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_8_R3</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_12_R1</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_16_R1</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_17_R1</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_18_R2</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_19_R2</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_19_R3</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.andrei1058.spigot.sidebar</groupId>
<artifactId>sidebar-v1_20_R1</artifactId>
<version>23.6</version>
<version>23.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- End of Sidebar LIB-->
Expand Down
35 changes: 22 additions & 13 deletions bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@
import com.andrei1058.bedwars.money.internal.MoneyListeners;
import com.andrei1058.bedwars.shop.ShopManager;
import com.andrei1058.bedwars.sidebar.*;
import com.andrei1058.bedwars.sidebar.thread.RefreshTitleTask;
import com.andrei1058.bedwars.sidebar.thread.RefreshPlaceholdersTask;
import com.andrei1058.bedwars.sidebar.thread.RefreshLifeTask;
import com.andrei1058.bedwars.sidebar.thread.RefreshTabListTask;
import com.andrei1058.bedwars.sidebar.thread.*;
import com.andrei1058.bedwars.stats.StatsManager;
import com.andrei1058.bedwars.support.citizens.CitizensListener;
import com.andrei1058.bedwars.support.citizens.JoinNPC;
Expand Down Expand Up @@ -394,7 +391,7 @@ public void onEnable() {
ArenaSocket.sendMessage(Arena.getArenas().get(0));
}
}*/
}, 40L);
}, 5L);

/* Save messages for stats gui items if custom items added, for each language */
Language.setupCustomStatsMessages();
Expand Down Expand Up @@ -520,49 +517,61 @@ public void onEnable() {

int playerListRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_LIST_REFRESH);
if (playerListRefreshInterval < 1) {
Bukkit.getLogger().info("Scoreboard names list refresh is disabled. (Is set to " + playerListRefreshInterval + ").");
Bukkit.getLogger().info("Scoreboard names list refresh is disabled. (It is set to " + playerListRefreshInterval + ").");
} else {
if (playerListRefreshInterval < 20) {
Bukkit.getLogger().warning("Scoreboard names list refresh interval is set to: " + playerListRefreshInterval);
Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks.");
Bukkit.getLogger().warning("If you expect performance issues please increase its timer.");
}
Bukkit.getScheduler().runTaskTimer(this, new RefreshTabListTask(), 23L, playerListRefreshInterval);
Bukkit.getScheduler().runTaskTimer(this, new RefreshPlayerListTask(), 1L, playerListRefreshInterval);
}

int placeholdersRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_PLACEHOLDERS_REFRESH_INTERVAL);
if (placeholdersRefreshInterval < 1) {
Bukkit.getLogger().info("Scoreboard placeholders refresh is disabled. (Is set to " + placeholdersRefreshInterval + ").");
Bukkit.getLogger().info("Scoreboard placeholders refresh is disabled. (It is set to " + placeholdersRefreshInterval + ").");
} else {
if (placeholdersRefreshInterval < 20) {
Bukkit.getLogger().warning("Scoreboard placeholders refresh interval is set to: " + placeholdersRefreshInterval);
Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks.");
Bukkit.getLogger().warning("If you expect performance issues please increase its timer.");
}
Bukkit.getScheduler().runTaskTimer(this, new RefreshPlaceholdersTask(), 28L, placeholdersRefreshInterval);
Bukkit.getScheduler().runTaskTimer(this, new RefreshPlaceholdersTask(), 1L, placeholdersRefreshInterval);
}

int titleRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_TITLE_REFRESH_INTERVAL);
if (titleRefreshInterval < 1) {
Bukkit.getLogger().info("Scoreboard title refresh is disabled. (Is set to " + titleRefreshInterval + ").");
Bukkit.getLogger().info("Scoreboard title refresh is disabled. (It is set to " + titleRefreshInterval + ").");
} else {
if (titleRefreshInterval < 4) {
Bukkit.getLogger().warning("Scoreboard title refresh interval is set to: " + titleRefreshInterval);
Bukkit.getLogger().warning("If you expect performance issues please increase its timer.");
}
Bukkit.getScheduler().runTaskTimerAsynchronously(this, new RefreshTitleTask(), 32L, titleRefreshInterval);
Bukkit.getScheduler().runTaskTimerAsynchronously(this, new RefreshTitleTask(), 1L, titleRefreshInterval);
}

int healthAnimationInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_REFRESH);
if (healthAnimationInterval < 1) {
Bukkit.getLogger().info("Scoreboard health animation refresh is disabled. (Is set to " + healthAnimationInterval + ").");
Bukkit.getLogger().info("Scoreboard health animation refresh is disabled. (It is set to " + healthAnimationInterval + ").");
} else {
if (healthAnimationInterval < 20) {
Bukkit.getLogger().warning("Scoreboard health animation refresh interval is set to: " + healthAnimationInterval);
Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks.");
Bukkit.getLogger().warning("If you expect performance issues please increase its timer.");
}
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new RefreshLifeTask(), 40L, healthAnimationInterval);
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new RefreshLifeTask(), 1L, healthAnimationInterval);
}

int tabHeaderFooterRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_REFRESH_INTERVAL);
if (tabHeaderFooterRefreshInterval < 1 || !config.getBoolean(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_ENABLE)) {
Bukkit.getLogger().info("Scoreboard Tab header-footer refresh is disabled.");
} else {
if (tabHeaderFooterRefreshInterval < 20) {
Bukkit.getLogger().warning("Scoreboard tab header-footer refresh interval is set to: " + tabHeaderFooterRefreshInterval);
Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks.");
Bukkit.getLogger().warning("If you expect performance issues please increase its timer.");
}
Bukkit.getScheduler().runTaskTimer(this, new RefreshTabHeaderFooterTask(), 1L, tabHeaderFooterRefreshInterval);
}

registerEvents(new ScoreboardListener());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public MainConfig(Plugin plugin, String name) {
yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_LIST_REFRESH, 1200);
yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_IN_TAB, true);
yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_REFRESH, 300);
yml.addDefault(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_ENABLE, true);
yml.addDefault(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_REFRESH_INTERVAL, 20);

yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_REJOIN_TIME, 60 * 5);
yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_RE_SPAWN_INVULNERABILITY, 4000);
yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_MODE_GAMES_BEFORE_RESTART, 30);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,29 @@ public Romanian() {

// this must stay here
// move message to new path
if (yml.get("player-die-knocked-regular") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL) == null){
if (yml.get("player-die-knocked-regular") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL) == null) {
yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL, yml.getString("player-die-knocked-regular"));
yml.set("player-die-knocked-regular", null);
}
if (yml.get("player-die-knocked-final") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL) == null){
if (yml.get("player-die-knocked-final") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL) == null) {
yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL, yml.getString("player-die-knocked-final"));
yml.set("player-die-knocked-final", null);
}

yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of("","&6{serverIp}", ""));
yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of("","&6{serverIp}", "", "&fJoci alaturi de {online} jucatori", "Powered by BedWars1058"));
yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER,"&a{serverIp}");
yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of("", "&a{serverIp}", ""));
yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of("", "&fJoci alaturi de {on} jucatori", "Powered by BedWars1058,&a{serverIp}", ""));
yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of("", "&a{serverIp}", ""));
yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of("", "Se asteapta jucatori,Se asteapta jucatori.,Se asteapta jucatori.., Se asteapta Jucatori...", "&f{on}&a/&f{max}", "", "&a{serverIp}", "&fPowered by BedWars1058", ""));

yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR, "&9{serverIp}");

yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, "&a{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING, "&6{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}");
yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR, "&9{serverIp}");

yml.options().copyDefaults(true);
yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o<arena/group>", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)"));
Expand Down Expand Up @@ -123,7 +124,7 @@ public Romanian() {
yml.addDefault(Messages.COMMAND_PARTY_PROMOTE_OWNER, "{prefix}&eAi fost promovat ca proprietar al petrecerii");
yml.addDefault(Messages.COMMAND_PARTY_PROMOTE_NEW_OWNER, "{prefix}&7 &e{player} a fost promovat ca proprietar");
yml.addDefault(Messages.COMMAND_PARTY_INFO_OWNER, "\n{prefix}&eProprietarul petrecerii este: &7{owner}");
yml.addDefault(Messages.COMMAND_PARTY_INFO_PLAYERS,"{prefix}&eMembrii sunt:");
yml.addDefault(Messages.COMMAND_PARTY_INFO_PLAYERS, "{prefix}&eMembrii sunt:");
yml.addDefault(Messages.COMMAND_PARTY_INFO_PLAYER, "&7{player}");
yml.addDefault(Messages.COMMAND_NOT_FOUND_OR_INSUFF_PERMS, "{prefix}&cComanda nu a fost gasita sau nu ai permisiunea!");
yml.addDefault(Messages.COMMAND_FORCESTART_NOT_IN_GAME, "§c▪ §7Nu esti in joc!");
Expand Down Expand Up @@ -338,7 +339,7 @@ public Romanian() {
addDefaultStatsMsg(yml, "games-played", "&6Partide Jucate", "&f{gamesPlayed}");


yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fHarta: &a{map}", "", "&fJucatori: &a{on}/{max}", "", "&fIn asteptare...", "", "§fMod: &a{group}", "&fVersiune: &7{version}", "", "&e{serverIp}"));
yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fHarta: &a{map}", "", "&fJucatori: &a{on}/{max}", "", "&fIn asteptare,&fIn asteptare.,&fIn asteptare..,&fIn asteptare...", "", "§fMod: &a{group}", "&fVersiune: &7{version}", "", "&e{serverIp}"));
yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fJucatori: &a{on}/{max}", "", "&fIncepe in &a{time}s", "", "§fMod: &a{group}", "&fVersiune: &7{version}", "", "&e{serverIp}"));
yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}"));

Expand Down
Loading

0 comments on commit f7736fe

Please sign in to comment.