forked from External/mage
Improved reconnect and tournament handling. Reconnect time is now shown for disconneted players on player list and tournament panel. You can now reconnect (during 3 minutes) to a tournament also if meanwhile new game (after sideboarding ended) or round was started. Conceding the complete match in a tournament can no longer result in a draw, if you won games before. Quitting a tournament does now always end all active games of that quitting player.
This commit is contained in:
parent
c76529bf91
commit
9ff5bcbd92
29 changed files with 282 additions and 109 deletions
|
|
@ -8,11 +8,13 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
@ -164,4 +166,17 @@ public class SystemUtil {
|
|||
System.out.println(sanitize("anPlsdf123 ") + "|");
|
||||
System.out.println(sanitize("anPlsdf123\r\n") + "|");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a diff between two dates
|
||||
*
|
||||
* @param date1 the oldest date
|
||||
* @param date2 the newest date
|
||||
* @param timeUnit the unit in which you want the diff
|
||||
* @return the diff value, in the provided unit
|
||||
*/
|
||||
public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {
|
||||
long diffInMillies = date2.getTime() - date1.getTime();
|
||||
return timeUnit.convert(diffInMillies, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue