Fetch tab list ip from the API

This commit is contained in:
Potato 2017-12-25 02:13:00 +08:00 committed by Ashcon Partovi
parent 406804e019
commit f6aa12bcf4
2 changed files with 9 additions and 3 deletions

View File

@ -39,6 +39,7 @@ import tc.oc.pgm.restart.RestartListener;
import tc.oc.pgm.rotation.DynamicRotationListener; import tc.oc.pgm.rotation.DynamicRotationListener;
import tc.oc.pgm.settings.Settings; import tc.oc.pgm.settings.Settings;
import tc.oc.pgm.spawns.states.State; import tc.oc.pgm.spawns.states.State;
import tc.oc.pgm.tablist.MatchFooterTabEntry;
import tc.oc.pgm.tnt.license.LicenseBroker; import tc.oc.pgm.tnt.license.LicenseBroker;
import tc.oc.pgm.tnt.license.LicenseCommands; import tc.oc.pgm.tnt.license.LicenseCommands;
import tc.oc.pgm.tnt.license.LicenseMonitor; import tc.oc.pgm.tnt.license.LicenseMonitor;
@ -104,5 +105,6 @@ public final class PGMManifest extends HybridManifest {
requestStaticInjection(State.class); requestStaticInjection(State.class);
requestStaticInjection(PollCommands.class); requestStaticInjection(PollCommands.class);
requestStaticInjection(MatchFooterTabEntry.class);
} }
} }

View File

@ -3,11 +3,13 @@ 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.servers.LocalServerDocument;
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.minecraft.api.server.LocalServer;
import tc.oc.pgm.Config; 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;
@ -15,6 +17,7 @@ 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 {
@ -24,6 +27,7 @@ public class MatchFooterTabEntry extends DynamicTabEntry {
return new MatchFooterTabEntry(key); return new MatchFooterTabEntry(key);
} }
} }
@Inject private static LocalServerDocument document;
private final Match match; private final Match match;
private @Nullable Task tickTask; private @Nullable Task tickTask;
@ -58,11 +62,11 @@ 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);
String datacenter = Config.PlayerList.datacenter(); String domain = document.domain();
String server = Config.PlayerList.server(); String server = Config.PlayerList.server();
if(datacenter != null) { if(domain != null) {
content.extra(new Component(datacenter, ChatColor.WHITE, ChatColor.BOLD), content.extra(new Component(domain, ChatColor.WHITE, ChatColor.BOLD),
new Component(" - ")); new Component(" - "));
} }