Add %ajqueue_status_<server>% placeholder
This commit is contained in:
@@ -24,7 +24,7 @@ dependencies {
|
||||
|
||||
compileOnly("org.spongepowered:configurate-yaml:4.0.0")
|
||||
|
||||
compileOnly("us.ajg0702:ajUtils:1.1.22")
|
||||
compileOnly("us.ajg0702:ajUtils:1.2.10")
|
||||
|
||||
compileOnly(group = "org.spigotmc", name = "spigot", version = "1.16.5-R0.1-SNAPSHOT")
|
||||
compileOnly("me.clip:placeholderapi:2.10.4")
|
||||
|
||||
@@ -175,6 +175,9 @@ public class Placeholders extends PlaceholderExpansion {
|
||||
if(identifier.matches("queuedfor_*.*")) {
|
||||
return "0";
|
||||
}
|
||||
if(identifier.matches("status_*.*")) {
|
||||
return "Loading";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,22 +188,25 @@ public class Placeholders extends PlaceholderExpansion {
|
||||
private String parsePlaceholder(Player player, String identifier) {
|
||||
if(identifier.equalsIgnoreCase("queued")) {
|
||||
plugin.sendMessage(player, "queuename", "");
|
||||
}
|
||||
} else
|
||||
if(identifier.equalsIgnoreCase("position")) {
|
||||
plugin.sendMessage(player, "position", "");
|
||||
}
|
||||
} else
|
||||
if(identifier.equalsIgnoreCase("of")) {
|
||||
plugin.sendMessage(player, "positionof", "");
|
||||
}
|
||||
} else
|
||||
if(identifier.equalsIgnoreCase("inqueue")) {
|
||||
plugin.sendMessage(player, "inqueue", "");
|
||||
}
|
||||
} else
|
||||
if(identifier.equalsIgnoreCase("estimated_time")) {
|
||||
plugin.sendMessage(player, "estimated_time", "");
|
||||
}
|
||||
} else
|
||||
if(identifier.matches("queuedfor_*.*")) {
|
||||
plugin.sendMessage(player, "queuedfor", identifier.split("_")[1]);
|
||||
}
|
||||
} else
|
||||
if(identifier.matches("status_*.*")) {
|
||||
plugin.sendMessage(player, "status", identifier.split("_")[1]);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
@@ -178,6 +178,20 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
|
||||
phs.put("estimated_time", time);
|
||||
placeholders.responseCache.put(p, phs);
|
||||
}
|
||||
if(subchannel.equals("status")) {
|
||||
String playername = in.readUTF();
|
||||
String server = in.readUTF();
|
||||
|
||||
Player p = Bukkit.getPlayer(playername);
|
||||
if(p == null) return;
|
||||
if(!p.isOnline()) return;
|
||||
|
||||
String status = in.readUTF();
|
||||
HashMap<String, String> phs = placeholders.responseCache.get(p);
|
||||
if(phs == null) phs = new HashMap<>();
|
||||
phs.put("status_"+server, status+"");
|
||||
placeholders.responseCache.put(p, phs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -207,9 +221,7 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
if(hasProxy) return;
|
||||
Bukkit.getScheduler().runTask(this, () -> {
|
||||
sendMessage(e.getPlayer(), "ack", "");
|
||||
});
|
||||
Bukkit.getScheduler().runTask(this, () -> sendMessage(e.getPlayer(), "ack", ""));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
|
||||
Reference in New Issue
Block a user