use of com.google.gwt.i18n.shared.DateTimeFormat in project Mindustry by Anuken.
the class HtmlLauncher method createApplicationListener.
@Override
public ApplicationListener createApplicationListener() {
instance = this;
setLogLevel(LOG_NONE);
setLoadingListener(new LoadingListener() {
@Override
public void beforeSetup() {
}
@Override
public void afterSetup() {
scaleCanvas();
setupResizeHook();
}
});
Net.setClientProvider(new WebsocketClient());
Platform.instance = new Platform() {
DateTimeFormat format = DateTimeFormat.getFormat("EEE, dd MMM yyyy HH:mm:ss");
@Override
public String format(Date date) {
return format.format(date);
}
@Override
public String format(int number) {
return NumberFormat.getDecimalFormat().format(number);
}
@Override
public boolean canJoinGame() {
String ref = Document.get().getReferrer();
return !ref.startsWith("https") && !ref.contains("itch.io");
}
@Override
public byte[] getUUID() {
Settings.defaults("uuid", "");
String uuid = Settings.getString("uuid");
if (uuid.isEmpty()) {
byte[] result = new byte[8];
new Random().nextBytes(result);
uuid = new String(Base64Coder.encode(result));
Settings.putString("uuid", uuid);
Settings.save();
return result;
}
return Base64Coder.decode(uuid);
}
};
return new Mindustry();
}
Aggregations