From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/console/ConnectionRecord.java | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 NET/worlds/console/ConnectionRecord.java (limited to 'NET/worlds/console/ConnectionRecord.java') diff --git a/NET/worlds/console/ConnectionRecord.java b/NET/worlds/console/ConnectionRecord.java new file mode 100644 index 0000000..74e7867 --- /dev/null +++ b/NET/worlds/console/ConnectionRecord.java @@ -0,0 +1,47 @@ +package NET.worlds.console; + +import java.util.Date; +import java.util.Vector; + +class ConnectionRecord { + private static Vector recordList = new Vector(); + private String _who = null; + private Date _startDelayTime = null; + + public ConnectionRecord(String who) { + this._who = who; + this._startDelayTime = new Date(); + } + + public boolean isExpired(Date now) { + return now.getTime() - this._startDelayTime.getTime() > 15000L; + } + + public String getWho() { + return this._who; + } + + public static Vector getList() { + return recordList; + } + + public static synchronized boolean checkList(String w) { + boolean delayed = false; + int i = 0; + Date now = new Date(); + + while (!recordList.isEmpty() && i < recordList.size()) { + ConnectionRecord r = recordList.elementAt(i); + if (r.isExpired(now)) { + recordList.removeElementAt(i); + } else { + i++; + if (r.getWho().equals(w)) { + delayed = true; + } + } + } + + return delayed; + } +} -- cgit v1.2.3