Comments (4)
我的想法:如
if (System.nanoTime()/1000000 - player.getLastActionTime() > 600000) afk_player.fuji$setAfk(true);
这样 awa
实际上, AfkChecker是一个全局的定时器. 它的检查周期是全局的, 但是根据每个玩家有一个lastActionTime. 换句话说, 如果AfkChecker的检查间隔为3分钟, 那么当1个玩家被标记为已挂机时, 该玩家的实际离开时间可能为3~6分钟.
之所以使用单个全局的AfkChecker, 并且使用一个较大的时间间隔. 是为了性能考虑.
AfkChecker实际上并不判断玩家是否处于挂机状态, 而只是简单地比较该玩家距离上次活动的时间差.
而当玩家发送活动封包时, 也只是简单地更新该时间戳.
这个设计和很多现成的方案相异. 当然, 使用你所提到的方案是更符合直觉的.
from fuji-fabric.
我的想法:如if (System.nanoTime()/1000000 - player.getLastActionTime() > 600000) afk_player.fuji$setAfk(true);
这样
awa
from fuji-fabric.
我的想法:如
if (System.nanoTime()/1000000 - player.getLastActionTime() > 600000) afk_player.fuji$setAfk(true);
这样 awa实际上, AfkChecker是一个全局的定时器. 它的检查周期是全局的, 但是根据每个玩家有一个lastActionTime. 换句话说, 如果AfkChecker的检查间隔为3分钟, 那么当1个玩家被标记为已挂机时, 该玩家的实际离开时间可能为3~6分钟.
之所以使用单个全局的AfkChecker, 并且使用一个较大的时间间隔. 是为了性能考虑. AfkChecker实际上并不判断玩家是否处于挂机状态, 而只是简单地比较该玩家距离上次活动的时间差. 而当玩家发送活动封包时, 也只是简单地更新该时间戳.
这个设计和很多现成的方案相异. 当然, 使用你所提到的方案是更符合直觉的.
哦这样啊,但是还有一个问题是getLastActionTime是不会记录持续的移动的,所以当服里有几个人在划船/跑图的时候会突然几个人一起afk这样( )有点怪hh
from fuji-fabric.
我的想法:如
if (System.nanoTime()/1000000 - player.getLastActionTime() > 600000) afk_player.fuji$setAfk(true);
这样 awa实际上, AfkChecker是一个全局的定时器. 它的检查周期是全局的, 但是根据每个玩家有一个lastActionTime. 换句话说, 如果AfkChecker的检查间隔为3分钟, 那么当1个玩家被标记为已挂机时, 该玩家的实际离开时间可能为3~6分钟.
之所以使用单个全局的AfkChecker, 并且使用一个较大的时间间隔. 是为了性能考虑. AfkChecker实际上并不判断玩家是否处于挂机状态, 而只是简单地比较该玩家距离上次活动的时间差. 而当玩家发送活动封包时, 也只是简单地更新该时间戳.
这个设计和很多现成的方案相异. 当然, 使用你所提到的方案是更符合直觉的.哦这样啊,但是还有一个问题是getLastActionTime是不会记录持续的移动的,所以当服里有几个人在划船/跑图的时候会突然几个人一起afk这样( )有点怪hh
实际上, CMI的Afk检测模块也有类似的行为, 同时将多个已挂机的玩家进行标记. 而不是逐个进行标记.
如果需要的话, 你可以改成更精准的方式. 目前这个方法的实现比较简单, 但不是非常准确.
from fuji-fabric.
Related Issues (20)
- port to neo-forge / forge
- command cooldown not working HOT 2
- Global permissions are ignored with zero-command-permission HOT 2
- Skin Module Web Set Not Working HOT 7
- Reply Module Suggestion HOT 2
- How to turn off chat format :sob: HOT 2
- A fully documented wiki is required.
- Update to 1.21? HOT 1
- Home module suggestion HOT 2
- add a feature to decide the level of `/enchantment` table HOT 4
- Continuously spamming error messages when entering /deathlog view <username> command HOT 5
- Fly up 1 space when sitting with the /sit command and fall down when sitting up stairs HOT 1
- Can you create a discord server for convenient communication or Q&A? HOT 3
- How to assign rights and prefixes of rights HOT 2
- How do I set permissions with the PlayerRoles mod? HOT 2
- Blocks not updating in the 1.2.4-partial-backport version HOT 1
- Fuji's new 1.2.4-partial-backport crashes minecraft on launch HOT 6
- A more flexible way to upgrade/down-grade the configuration structure. HOT 1
- CommandRewrite isn't working HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fuji-fabric.