跑刀仔
求显示玩家累计在线时间的计分板指令,希望有哪位大佬解答。

冷い桜_
做20个ticks加1的dummy计分板

尸先peng
本帖最后由 尸先peng 于 2021-11-28 11:52 编辑

scoreboard objectives add 1 dummy
scoreboard objectives add time dummy
scoreboard objectives setdisplay sidebar

scoreboard players add @a 1 1
execute as @a[scores={1=20..}] at @s run scoreboard players add @s time 1
execute as @a[scores={1=20..}] at @s run scoreboard players reset @s  1

这样就可以显示玩家在线时间了(单位:秒)

如果要以分钟为单位,可以把加粗数字改为120
以小时为单位同理,将加粗数字改为7200


感谢下方评分提醒↓↓↓

Top_Hsiah
希望这个能帮助到你

mxz_dada
尸先peng 发表于 2021-11-27 17:40
scoreboard objectives add 1 dummy
scoreboard objectives add time dum ...

服务器里的话@a这种目标选择器没法用吧

跑刀仔
mxz_dada 发表于 2021-11-28 20:58
服务器里的话@a这种目标选择器没法用吧

确实输入后是红色的

尸先peng
跑刀仔 发表于 2021-11-28 21:17
确实输入后是红色的

按道理单人和多人游戏都是可以使用的(我不太了解服务器的机制)

但可以知道的是,如果一定要指令实现就必须要用execute来弄

dpy0428
跑刀仔 发表于 2021-11-28 21:17
确实输入后是红色的

@a不行的话可以试试@e[type=player]

坏怪怪
冷い桜_ 发表于 2021-11-27 17:05
做20个ticks加1的dummy计分板

应该怎么实现呢

坏怪怪
尸先peng 发表于 2021-11-27 17:02
scoreboard objectives add 1 dummy
scoreboard objectives add time dum ...

你这里应该搞错了

1s=20t的话
1min=60s*20t=1200t
1h=60min*60s*20t=72000t

nono172643
mxz_dada 发表于 2021-11-28 20:58
服务器里的话@a这种目标选择器没法用吧

我使用这个插件报错
  1. [16:42:30 ERROR]: Could not pass event InventoryClickEvent to ATime v1.0.2
  2. java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 19)
  3.         at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[patched_1.16.5.jar:git-Purpur-1171]
  4.         at org.bukkit.craftbukkit.v1_16_R3.CraftServer.createInventory(CraftServer.java:1892) ~[patched_1.16.5.jar:git-Purpur-1171]
  5.         at org.bukkit.Bukkit.createInventory(Bukkit.java:1280) ~[patched_1.16.5.jar:git-Purpur-1171]
  6.         at me.albert.atime.Gui.Kits.Open(Kits.java:26) ~[?:?]
  7.         at me.albert.atime.Gui.GUIListener.onClick(GUIListener.java:55) ~[?:?]
  8.         at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor148.execute(Unknown Source) ~[?:?]
  9.         at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Purpur-1171]
  10.         at org.bukkit.plugin.EventExecutor$Lambda$5367/0x0000000078b71640.execute(Unknown Source) ~[?:?]
  11.         at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Purpur-1171]
  12.         at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Purpur-1171]
  13.         at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.16.5.jar:git-Purpur-1171]
  14.         at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:2848) ~[patched_1.16.5.jar:git-Purpur-1171]
  15.         at net.minecraft.server.v1_16_R3.PacketPlayInWindowClick.a(SourceFile:32) ~[patched_1.16.5.jar:git-Purpur-1171]
  16.         at net.minecraft.server.v1_16_R3.PacketPlayInWindowClick.a(SourceFile:10) ~[patched_1.16.5.jar:git-Purpur-1171]
  17.         at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:55) ~[patched_1.16.5.jar:git-Purpur-1171]
  18.         at net.minecraft.server.v1_16_R3.PlayerConnectionUtils$Lambda$9259/0x00000000021d1868.run(Unknown Source) ~[?:?]
  19.         at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Purpur-1171]
  20.         at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Purpur-1171]
  21.         at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Purpur-1171]
  22.         at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Purpur-1171]
  23.         at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1339) ~[patched_1.16.5.jar:git-Purpur-1171]
  24.         at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1332) ~[patched_1.16.5.jar:git-Purpur-1171]
  25.         at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeAll(IAsyncTaskHandler.java:95) ~[patched_1.16.5.jar:git-Purpur-1171]
  26.         at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1469) ~[patched_1.16.5.jar:git-Purpur-1171]
  27.         at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1142) ~[patched_1.16.5.jar:git-Purpur-1171]
  28.         at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:293) ~[patched_1.16.5.jar:git-Purpur-1171]
  29.         at net.minecraft.server.v1_16_R3.MinecraftServer$Lambda$3177/0x00000000767a8408.run(Unknown Source) ~[?:?]
  30.         at java.lang.Thread.run(Thread.java:883) [?:?]
复制代码

第一页 上一页 下一页 最后一页