Fix PlaytimeCommand and Timer not shown
All checks were successful
Build Plugin / build-test (push) Successful in 43s
All checks were successful
Build Plugin / build-test (push) Successful in 43s
This commit is contained in:
parent
d75cb90cb6
commit
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.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() + "Du hast den 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]);
|
||||
|
@ -3,6 +3,8 @@ 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.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -71,6 +73,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))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user