Compare commits
2 Commits
p20241125_
...
p20241125_
Author | SHA1 | Date | |
---|---|---|---|
1701006db3 | |||
885030eae3 |
@ -1,5 +1,6 @@
|
||||
package de.npid7.serverlite.Commands;
|
||||
|
||||
import de.npid7.serverlite.Helpers.Spielzeit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -9,30 +10,36 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.npid7.serverlite.Helpers.Spielzeit;
|
||||
|
||||
public class PlaytimeCommand implements CommandExecutor {
|
||||
private void makeMessage(OfflinePlayer pl, Player exec) {
|
||||
if (pl == null) {
|
||||
return;
|
||||
}
|
||||
exec.sendMessage("- " + ChatColor.GOLD.toString() + "PLAYTIME: ");
|
||||
exec.sendMessage("- " + ChatColor.GRAY.toString() + "Player: " + ChatColor.WHITE.toString() + pl.getName());
|
||||
// exec.sendMessage("- First Join: ");
|
||||
exec.sendMessage("- " + ChatColor.GRAY.toString() + "Spielzeit: " + ChatColor.GREEN.toString()
|
||||
+ Spielzeit.getHours(pl.getStatistic(Statistic.TOTAL_WORLD_TIME)));
|
||||
exec.sendMessage("- " + ChatColor.GOLD.toString() + "PlayTime: ");
|
||||
exec.sendMessage(
|
||||
"- " + ChatColor.GRAY.toString() + "Detailierte Spielzeit: " + ChatColor.GREEN.toString()
|
||||
"- " + ChatColor.GRAY.toString() + "Player: " + ChatColor.WHITE.toString() + pl.getName());
|
||||
// exec.sendMessage("- First Join: ");
|
||||
int playtime = Spielzeit.getHours(pl.getStatistic(Statistic.TOTAL_WORLD_TIME));
|
||||
String str = " Stunden";
|
||||
if (playtime == 1) {
|
||||
str = " Stunde";
|
||||
}
|
||||
exec.sendMessage("- " + ChatColor.GRAY.toString() + "Spielzeit: " + ChatColor.GREEN.toString()
|
||||
+ playtime + str);
|
||||
exec.sendMessage("- " + ChatColor.GRAY.toString()
|
||||
+ "Detailierte Spielzeit: " + ChatColor.GREEN.toString()
|
||||
+ Spielzeit.formatTicks(pl.getStatistic(Statistic.TOTAL_WORLD_TIME)));
|
||||
exec.sendMessage("- " + ChatColor.GRAY.toString() + "Du hast den Server " + ChatColor.GREEN.toString()
|
||||
+ (pl.getStatistic(Statistic.LEAVE_GAME) + 1) + ChatColor.GRAY.toString() + " mal betreten.");
|
||||
exec.sendMessage("- " + ChatColor.GRAY.toString() + "Server " + ChatColor.GREEN.toString()
|
||||
+ (pl.getStatistic(Statistic.LEAVE_GAME) + 1) + ChatColor.GRAY.toString()
|
||||
+ " mal betreten.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||
if (strings.length != 0) {
|
||||
if (!sender.hasPermission("d7.d7")) {
|
||||
sender.sendMessage(ChatColor.RED.toString() + "Nur Admins dürfen /plytime auf spieler anwenden");
|
||||
sender.sendMessage(
|
||||
ChatColor.RED.toString() + "Nur Admins dürfen /plytime auf spieler anwenden");
|
||||
return false;
|
||||
}
|
||||
OfflinePlayer pl = Bukkit.getOfflinePlayer(strings[0]);
|
||||
|
@ -2,8 +2,10 @@ package de.npid7.serverlite.Tasks;
|
||||
|
||||
import de.npid7.serverlite.D7ServerLite;
|
||||
import de.npid7.serverlite.Helpers.Spielzeit;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@ -46,12 +48,18 @@ public class TablistTask {
|
||||
if (playtime == 1) {
|
||||
str = " Stunde";
|
||||
}
|
||||
String tpsclr = ChatColor.GREEN.toString();
|
||||
if (tps < 18.0 && tps > 15.0) {
|
||||
tpsclr = ChatColor.GOLD.toString();
|
||||
} else if (tps <= 15 || tps > 20) {
|
||||
tpsclr = ChatColor.RED.toString();
|
||||
}
|
||||
pl.setPlayerListHeader(
|
||||
"\n§x§5§5§5§5§5§5§lѕ§x§5§B§5§B§5§B§lᴜ§x§6§1§6§1§6§1§lʀ§x§6§7§6§7§6§7§lᴠ§x§6§D§6§D§6§D§lɪ§x§7§3§7§3§7§3§lᴠ§x§7§9§7§9§7§9§lᴀ§x§8§0§8§0§8§0§lʟ§x§8§6§8§6§8§6§lᴘ§x§8§C§8§C§8§C§lʀ§x§9§2§9§2§9§2§lᴏ§x§9§8§9§8§9§8§lᴊ§x§9§E§9§E§9§E§lᴇ§x§A§4§A§4§A§4§lᴋ§x§A§A§A§A§A§A§lᴛ\n"
|
||||
+ "\n" + ChatColor.GRAY.toString() + "ᴅᴇɪɴ ᴘɪɴɢ" + ChatColor.DARK_GRAY.toString() + ": "
|
||||
+ ChatColor.GREEN.toString() + pl.getPing() + " " + ChatColor.GRAY.toString()
|
||||
+ "ѕᴇʀᴠᴇʀ ᴛᴘѕ" + ChatColor.DARK_GRAY.toString() + ": " + ChatColor.GREEN.toString()
|
||||
+ String.format("%.1f", tps) + "\n\n" + ChatColor.GRAY.toString() + "ѕᴘɪᴇʟᴢᴇɪᴛ"
|
||||
+ tpsclr + String.format("%.1f", tps) + "\n\n" + ChatColor.GRAY.toString() + "ѕᴘɪᴇʟᴢᴇɪᴛ"
|
||||
+ ChatColor.DARK_GRAY.toString() + ": " + ChatColor.GREEN.toString() + playtime + str
|
||||
+ "\n");
|
||||
pl.setPlayerListFooter("\n");
|
||||
@ -71,6 +79,11 @@ public class TablistTask {
|
||||
body += ChatColor.WHITE.toString() + pl.getDisplayName();
|
||||
body += " " + ChatColor.RED.toString() + pl.getStatistic(Statistic.DEATHS);
|
||||
pl.setPlayerListName(body);
|
||||
if (D7ServerLite.getInst().getPlayerConfig().getTimer(pl.getUniqueId())) {
|
||||
pl.spigot().sendMessage(ChatMessageType.ACTION_BAR,
|
||||
new TextComponent(ChatColor.GOLD.toString()
|
||||
+ Spielzeit.formatTicks(pl.getStatistic(Statistic.TOTAL_WORLD_TIME))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user