Skip to content

Commit

Permalink
Release v3.12-alpha.1+fabric
Browse files Browse the repository at this point in the history
Alpha release of v3.12. For testing purposes.
  • Loading branch information
TheCSDev committed Jul 3, 2024
1 parent cdf4ae1 commit a772184
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 22 deletions.
2 changes: 1 addition & 1 deletion betterstats-3-fabric-1.20.5/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ org.gradle.jvmargs=-Xmx1G
mod_name = Better Statistics Screen
mod_description = Improves the statistics screen and makes it more useful.
mod_author = TheCSDev
mod_version = 3.12+fabric-1.20.6
mod_version = 3.12-alpha.1+fabric-1.20.6

# Here you link the source code repository links:
mod_contact_homepage = https://github.com/TheCSMods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.thecsdev.betterstats.api.client.gui.screen;

import static io.github.thecsdev.betterstats.client.gui.stats.panel.StatsTabPanel.FILTER_ID_SCROLL_CACHE;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.io.IOException;
Expand All @@ -21,6 +22,7 @@
import io.github.thecsdev.betterstats.client.gui.stats.panel.impl.BetterStatsPanel.BetterStatsPanelProxy;
import io.github.thecsdev.betterstats.client.network.BetterStatsClientPlayNetworkHandler;
import io.github.thecsdev.betterstats.client.network.OtherClientPlayerStatsProvider;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TDialogBoxScreen;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenPlus;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenWrapper;
import io.github.thecsdev.tcdcommons.api.client.util.interfaces.IParentScreenProvider;
Expand Down Expand Up @@ -124,6 +126,8 @@ else if(this.statsProvider instanceof OtherClientPlayerStatsProvider ssps)
*/
public final void refresh() { if(!isOpen()) return; clearChildren(); init(); }
// --------------------------------------------------
//FIXME - REMOVE THE ALPHA NOTICE ONCE DONE WITH v3.12-alpha.1!
private static boolean SEEN_ALPHA_DIALOG = false;
protected final @Override void init()
{
//initialize the content pane panel
Expand All @@ -135,6 +139,31 @@ else if(this.statsProvider instanceof OtherClientPlayerStatsProvider ssps)
public final @Override StatFilterSettings getFilterSettings() { return BetterStatsScreen.this.filterSettings; }
});
addChild(this.bsPanel, false);

//alpha dialog
if(!SEEN_ALPHA_DIALOG)
{
SEEN_ALPHA_DIALOG = true;
final var d = new TDialogBoxScreen(
getAsScreen(),
literal("Thank you for downloading the alpha version"),
literal("(Note: I only got the 'en_us' version of this text. Sorry if you speak another language.)\n\n"
+ "Hello!\n"
+ "You are reading this because you downloaded the v3.12 alpha version of this mod. "
+ "As part of this release, I would like to test the new feature that is coming out, "
+ "called 'Quick share'. It can be found by using the 'Stats sharing' menu button.\n\n"
+ "If you do not mind, I would like to ask you to simply give the feature a try, and "
+ "see how it works and what you think about it. Then, I would like you to provide me with "
+ "some feedback, so I can see what could be changed or improved. Things like your opinion "
+ "on the feature, its current looks, do you want any UI changes or functionality changes, "
+ "and stuff like that basically. I plan on releasing v3.12 on 2024w27 or 2024w28 (aka "
+ "this or next week as of the release of this alpha).\n\n"
+ "Please see the release changelog for information on how to provide said feedback.\n\n"
+ "PS; I haven't yet implemented proper error handlers that explain 'what went wrong' in "
+ "an easy-to-understand way, so as of now, you'd just get a confusing error dialog box "
+ "whenever a quick-share error takes place."));
getClient().setScreen(d.getAsScreen());
}
}
// --------------------------------------------------
public final @Override boolean filesDragged(Collection<Path> files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static io.github.thecsdev.betterstats.util.io.BetterStatsWebApiUtils.GSON;
import static io.github.thecsdev.tcdcommons.api.util.io.HttpUtils.fetchSync;

import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.Locale;
Expand All @@ -13,7 +14,6 @@

import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.message.BasicHeader;
Expand Down Expand Up @@ -173,7 +173,7 @@ public QuickShareDownloadScreen(@Nullable Screen bssParent, @Nullable Screen par
final var statusCode = response.getStatusLine().getStatusCode();
final var statusMessage = response.getStatusLine().getReasonPhrase();
if(statusCode != 200)
throw new HttpException(
throw new IOException(
"BSS API server response message:\n----------\n" + responseMessage + "\n----------",
new HttpResponseException(statusCode, statusMessage));

Expand Down Expand Up @@ -237,7 +237,7 @@ else if(du_ready.get() == null)
responseBody = EntityUtils.toString(response.getEntity());

//throw the exception
throw new HttpException(
throw new IOException(
"Cloud server response message:\n----------\n" +
responseBody + "\n----------",
new HttpResponseException(statusCode, statusMessage));
Expand All @@ -247,7 +247,7 @@ else if(du_ready.get() == null)
final byte[] responseBody = (response.getEntity() != null) ?
EntityUtils.toByteArray(response.getEntity()) : null;
if(responseBody == null)
throw new HttpException("Cloud server responded with an empty file with no data inside of it.");
throw new IOException("Cloud server responded with an empty file with no data inside of it.");

//finally, conclude
@Nullable Instant expires_file = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.thecsdev.betterstats.client.gui.screen;

import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.betterstats.BetterStats.getModID;
import static io.github.thecsdev.betterstats.client.BetterStatsClient.MC_CLIENT;
import static io.github.thecsdev.betterstats.util.io.BetterStatsWebApiUtils.GSON;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;
import static io.github.thecsdev.tcdcommons.api.util.io.HttpUtils.fetchSync;

import java.io.IOException;
Expand All @@ -16,7 +16,6 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.entity.ContentType;
Expand Down Expand Up @@ -163,13 +162,13 @@ public CachedResource<JsonObject> fetchResourceSync() throws Exception
{
//read the response body as string
final @Nullable var httpResultEntity = httpResult.getEntity();
if(httpResultEntity == null) throw new HttpException("Missing HTTP response body.");
if(httpResultEntity == null) throw new IOException("Missing HTTP response body.");
httpResultStr = EntityUtils.toString(httpResultEntity);

//throw an exception if the server does not respond with status 200
final int statusCode = httpResult.getStatusLine().getStatusCode();
if(statusCode != 200)
throw new HttpException(
throw new IOException(
"BSS API server response message:\n----------\n" + httpResultStr + "\n----------",
new HttpResponseException(statusCode, httpResult.getStatusLine().getReasonPhrase()));
}
Expand Down Expand Up @@ -268,7 +267,7 @@ public CachedResource<String> fetchResourceSync() throws Exception
final var statusCode = response.getStatusLine().getStatusCode();
final var statusReason = response.getStatusLine().getReasonPhrase();
if(statusCode < 200 || statusCode > 299)
throw new HttpException(
throw new IOException(
"Cloud server response message:\n----------\n" +
responseBody + "\n----------",
new HttpResponseException(statusCode, statusReason));
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion betterstats-3-fabric-1.21/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ org.gradle.jvmargs=-Xmx1G
mod_name = Better Statistics Screen
mod_description = Improves the statistics screen and makes it more useful.
mod_author = TheCSDev
mod_version = 3.12+fabric-1.21
mod_version = 3.12-alpha.1+fabric-1.21

# Here you link the source code repository links:
mod_contact_homepage = https://github.com/TheCSMods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.thecsdev.betterstats.api.client.gui.screen;

import static io.github.thecsdev.betterstats.client.gui.stats.panel.StatsTabPanel.FILTER_ID_SCROLL_CACHE;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;

import java.io.IOException;
Expand All @@ -21,6 +22,7 @@
import io.github.thecsdev.betterstats.client.gui.stats.panel.impl.BetterStatsPanel.BetterStatsPanelProxy;
import io.github.thecsdev.betterstats.client.network.BetterStatsClientPlayNetworkHandler;
import io.github.thecsdev.betterstats.client.network.OtherClientPlayerStatsProvider;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TDialogBoxScreen;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenPlus;
import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenWrapper;
import io.github.thecsdev.tcdcommons.api.client.util.interfaces.IParentScreenProvider;
Expand Down Expand Up @@ -124,6 +126,8 @@ else if(this.statsProvider instanceof OtherClientPlayerStatsProvider ssps)
*/
public final void refresh() { if(!isOpen()) return; clearChildren(); init(); }
// --------------------------------------------------
//FIXME - REMOVE THE ALPHA NOTICE ONCE DONE WITH v3.12-alpha.1!
private static boolean SEEN_ALPHA_DIALOG = false;
protected final @Override void init()
{
//initialize the content pane panel
Expand All @@ -135,6 +139,31 @@ else if(this.statsProvider instanceof OtherClientPlayerStatsProvider ssps)
public final @Override StatFilterSettings getFilterSettings() { return BetterStatsScreen.this.filterSettings; }
});
addChild(this.bsPanel, false);

//alpha dialog
if(!SEEN_ALPHA_DIALOG)
{
SEEN_ALPHA_DIALOG = true;
final var d = new TDialogBoxScreen(
getAsScreen(),
literal("Thank you for downloading the alpha version"),
literal("(Note: I only got the 'en_us' version of this text. Sorry if you speak another language.)\n\n"
+ "Hello!\n"
+ "You are reading this because you downloaded the v3.12 alpha version of this mod. "
+ "As part of this release, I would like to test the new feature that is coming out, "
+ "called 'Quick share'. It can be found by using the 'Stats sharing' menu button.\n\n"
+ "If you do not mind, I would like to ask you to simply give the feature a try, and "
+ "see how it works and what you think about it. Then, I would like you to provide me with "
+ "some feedback, so I can see what could be changed or improved. Things like your opinion "
+ "on the feature, its current looks, do you want any UI changes or functionality changes, "
+ "and stuff like that basically. I plan on releasing v3.12 on 2024w27 or 2024w28 (aka "
+ "this or next week as of the release of this alpha).\n\n"
+ "Please see the release changelog for information on how to provide said feedback.\n\n"
+ "PS; I haven't yet implemented proper error handlers that explain 'what went wrong' in "
+ "an easy-to-understand way, so as of now, you'd just get a confusing error dialog box "
+ "whenever a quick-share error takes place."));
getClient().setScreen(d.getAsScreen());
}
}
// --------------------------------------------------
public final @Override boolean filesDragged(Collection<Path> files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static io.github.thecsdev.betterstats.util.io.BetterStatsWebApiUtils.GSON;
import static io.github.thecsdev.tcdcommons.api.util.io.HttpUtils.fetchSync;

import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.Locale;
Expand All @@ -13,7 +14,6 @@

import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.message.BasicHeader;
Expand Down Expand Up @@ -173,7 +173,7 @@ public QuickShareDownloadScreen(@Nullable Screen bssParent, @Nullable Screen par
final var statusCode = response.getStatusLine().getStatusCode();
final var statusMessage = response.getStatusLine().getReasonPhrase();
if(statusCode != 200)
throw new HttpException(
throw new IOException(
"BSS API server response message:\n----------\n" + responseMessage + "\n----------",
new HttpResponseException(statusCode, statusMessage));

Expand Down Expand Up @@ -237,7 +237,7 @@ else if(du_ready.get() == null)
responseBody = EntityUtils.toString(response.getEntity());

//throw the exception
throw new HttpException(
throw new IOException(
"Cloud server response message:\n----------\n" +
responseBody + "\n----------",
new HttpResponseException(statusCode, statusMessage));
Expand All @@ -247,7 +247,7 @@ else if(du_ready.get() == null)
final byte[] responseBody = (response.getEntity() != null) ?
EntityUtils.toByteArray(response.getEntity()) : null;
if(responseBody == null)
throw new HttpException("Cloud server responded with an empty file with no data inside of it.");
throw new IOException("Cloud server responded with an empty file with no data inside of it.");

//finally, conclude
@Nullable Instant expires_file = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.thecsdev.betterstats.client.gui.screen;

import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.betterstats.BetterStats.getModID;
import static io.github.thecsdev.betterstats.client.BetterStatsClient.MC_CLIENT;
import static io.github.thecsdev.betterstats.util.io.BetterStatsWebApiUtils.GSON;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal;
import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable;
import static io.github.thecsdev.tcdcommons.api.util.io.HttpUtils.fetchSync;

import java.io.IOException;
Expand All @@ -16,7 +16,6 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.entity.ContentType;
Expand Down Expand Up @@ -163,13 +162,13 @@ public CachedResource<JsonObject> fetchResourceSync() throws Exception
{
//read the response body as string
final @Nullable var httpResultEntity = httpResult.getEntity();
if(httpResultEntity == null) throw new HttpException("Missing HTTP response body.");
if(httpResultEntity == null) throw new IOException("Missing HTTP response body.");
httpResultStr = EntityUtils.toString(httpResultEntity);

//throw an exception if the server does not respond with status 200
final int statusCode = httpResult.getStatusLine().getStatusCode();
if(statusCode != 200)
throw new HttpException(
throw new IOException(
"BSS API server response message:\n----------\n" + httpResultStr + "\n----------",
new HttpResponseException(statusCode, httpResult.getStatusLine().getReasonPhrase()));
}
Expand Down Expand Up @@ -268,7 +267,7 @@ public CachedResource<String> fetchResourceSync() throws Exception
final var statusCode = response.getStatusLine().getStatusCode();
final var statusReason = response.getStatusLine().getReasonPhrase();
if(statusCode < 200 || statusCode > 299)
throw new HttpException(
throw new IOException(
"Cloud server response message:\n----------\n" +
responseBody + "\n----------",
new HttpResponseException(statusCode, statusReason));
Expand Down
Binary file not shown.

0 comments on commit a772184

Please sign in to comment.