summaryrefslogtreecommitdiff
path: root/src/main/java/com/redstoner/bungeeBans/Util.java
blob: c63380113084484bc4c912094381b03df95e26b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.redstoner.bungeeBans;

import com.mojang.api.profiles.HttpProfileRepository;
import com.mojang.api.profiles.Profile;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class Util {
	private static final HttpProfileRepository profileRepo = new HttpProfileRepository("minecraft");

	public static String dashUUID(String uuid) {
		return uuid.replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5");
	}

	public static String getNow() {
		return ZonedDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss Z"));
	}

	public static Profile[] findProfilesByNames(String... names) {
		return profileRepo.findProfilesByNames(names);
	}
}