Fix tab list not rendering from injection
This commit is contained in:
parent
ac776f4760
commit
894514eb9e
|
@ -3,19 +3,18 @@ package tc.oc.pgm.tablist;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import tc.oc.api.docs.Server;
|
import tc.oc.api.docs.Server;
|
||||||
import tc.oc.api.minecraft.MinecraftService;
|
|
||||||
import tc.oc.commons.core.scheduler.Task;
|
import tc.oc.commons.core.scheduler.Task;
|
||||||
import tc.oc.commons.bukkit.tablist.DynamicTabEntry;
|
import tc.oc.commons.bukkit.tablist.DynamicTabEntry;
|
||||||
import tc.oc.commons.bukkit.tablist.TabView;
|
import tc.oc.commons.bukkit.tablist.TabView;
|
||||||
import tc.oc.commons.core.chat.Component;
|
import tc.oc.commons.core.chat.Component;
|
||||||
import tc.oc.commons.core.formatting.PeriodFormats;
|
import tc.oc.commons.core.formatting.PeriodFormats;
|
||||||
|
import tc.oc.pgm.Config;
|
||||||
import tc.oc.pgm.match.Match;
|
import tc.oc.pgm.match.Match;
|
||||||
import tc.oc.pgm.match.MatchScope;
|
import tc.oc.pgm.match.MatchScope;
|
||||||
import tc.oc.pgm.PGMTranslations;
|
import tc.oc.pgm.PGMTranslations;
|
||||||
import tc.oc.commons.core.util.DefaultProvider;
|
import tc.oc.commons.core.util.DefaultProvider;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
public class MatchFooterTabEntry extends DynamicTabEntry {
|
public class MatchFooterTabEntry extends DynamicTabEntry {
|
||||||
|
|
||||||
|
@ -26,8 +25,6 @@ public class MatchFooterTabEntry extends DynamicTabEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject private static MinecraftService minecraftService;
|
|
||||||
|
|
||||||
private final Match match;
|
private final Match match;
|
||||||
private @Nullable Task tickTask;
|
private @Nullable Task tickTask;
|
||||||
|
|
||||||
|
@ -61,9 +58,8 @@ public class MatchFooterTabEntry extends DynamicTabEntry {
|
||||||
public BaseComponent getContent(TabView view) {
|
public BaseComponent getContent(TabView view) {
|
||||||
Component content = new Component(ChatColor.DARK_GRAY);
|
Component content = new Component(ChatColor.DARK_GRAY);
|
||||||
|
|
||||||
Server server = minecraftService.getLocalServer();
|
String datacenter = Config.PlayerList.datacenter();
|
||||||
String datacenter = server.datacenter();
|
String server = Config.PlayerList.server();
|
||||||
String name = server.name();
|
|
||||||
|
|
||||||
if(datacenter != null) {
|
if(datacenter != null) {
|
||||||
content.extra(new Component(datacenter, ChatColor.WHITE, ChatColor.BOLD),
|
content.extra(new Component(datacenter, ChatColor.WHITE, ChatColor.BOLD),
|
||||||
|
@ -73,9 +69,9 @@ public class MatchFooterTabEntry extends DynamicTabEntry {
|
||||||
content.extra(new Component(PGMTranslations.get().t("command.match.matchInfo.time", view.getViewer()) + ": ", ChatColor.GRAY),
|
content.extra(new Component(PGMTranslations.get().t("command.match.matchInfo.time", view.getViewer()) + ": ", ChatColor.GRAY),
|
||||||
new Component(PeriodFormats.formatColons(this.match.runningTime()), this.match.isRunning() ? ChatColor.GREEN : ChatColor.GOLD));
|
new Component(PeriodFormats.formatColons(this.match.runningTime()), this.match.isRunning() ? ChatColor.GREEN : ChatColor.GOLD));
|
||||||
|
|
||||||
if(name != null) {
|
if(server != null) {
|
||||||
content.extra(new Component(" - "),
|
content.extra(new Component(" - "),
|
||||||
new Component(name, ChatColor.WHITE, ChatColor.BOLD));
|
new Component(server, ChatColor.WHITE, ChatColor.BOLD));
|
||||||
}
|
}
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
|
|
Loading…
Reference in New Issue