1.18.2
This commit is contained in:
parent
2863ed317b
commit
a9da75e86e
|
|
@ -5,10 +5,9 @@ import com.alttd.afkdectector.afkplayer.AFKPlayer;
|
||||||
import com.alttd.afkdectector.config.Config;
|
import com.alttd.afkdectector.config.Config;
|
||||||
import com.alttd.afkdectector.config.Messages;
|
import com.alttd.afkdectector.config.Messages;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import net.kyori.adventure.text.minimessage.template.TemplateResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
@ -35,18 +34,18 @@ public class AFKListCommand implements CommandExecutor, TabCompleter {
|
||||||
if(System.currentTimeMillis() - standingTime > Config.TOGGLETIME * 60 * 1000) {
|
if(System.currentTimeMillis() - standingTime > Config.TOGGLETIME * 60 * 1000) {
|
||||||
afkplayers += 1;
|
afkplayers += 1;
|
||||||
message = message.append(Component.newline());
|
message = message.append(Component.newline());
|
||||||
List<Template> templates = new ArrayList<>(List.of(
|
TagResolver templates = TagResolver.resolver(
|
||||||
Template.template("player", afkplayer.getPlayerName()),
|
Placeholder.parsed("player", afkplayer.getPlayerName()),
|
||||||
Template.template("afktime", (System.currentTimeMillis() - standingTime) / 1000 + "")
|
Placeholder.parsed("afktime", (System.currentTimeMillis() - standingTime) / 1000 + "")
|
||||||
));
|
);
|
||||||
Component userinfo = miniMessage.deserialize(Messages.AFK_LIST_ENTRY.getMessage(), TemplateResolver.templates(templates));
|
Component userinfo = miniMessage.deserialize(Messages.AFK_LIST_ENTRY.getMessage(), templates);
|
||||||
message = message.append(userinfo);
|
message = message.append(userinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Template> templates = new ArrayList<>(List.of(
|
TagResolver templates = TagResolver.resolver(
|
||||||
Template.template("afkplayers", Integer.toString(afkplayers))
|
Placeholder.parsed("afkplayers", Integer.toString(afkplayers))
|
||||||
));
|
);
|
||||||
Component component = miniMessage.deserialize(Messages.AFK_LIST.getMessage(), TemplateResolver.templates(templates));
|
Component component = miniMessage.deserialize(Messages.AFK_LIST.getMessage(), templates);
|
||||||
sender.sendMessage(component.append(message));
|
sender.sendMessage(component.append(message));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,11 @@
|
||||||
package com.alttd.afkdectector.command;
|
package com.alttd.afkdectector.command;
|
||||||
|
|
||||||
import com.alttd.afkdectector.AFKDetector;
|
import com.alttd.afkdectector.AFKDetector;
|
||||||
import com.alttd.afkdectector.afkplayer.AFKPlayer;
|
|
||||||
import com.alttd.afkdectector.config.Config;
|
|
||||||
import com.alttd.afkdectector.config.Messages;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReloadCommand implements CommandExecutor, TabCompleter {
|
public class ReloadCommand implements CommandExecutor, TabCompleter {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user