Skip to content

Commit

Permalink
Update globaltagsjava, adapt code
Browse files Browse the repository at this point in the history
  • Loading branch information
RappyTV committed Jul 28, 2024
1 parent 8216677 commit 12a04ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

dependencies {
labyApi("api")
maven(mavenCentral(), "com.rappytv.globaltags:GlobalTagsJava:1.0.3")
maven(mavenCentral(), "com.rappytv.globaltags:GlobalTagsJava:1.0.5")

// If you want to use external libraries, you can do that here.
// The dependencies that are specified here are loaded into your project but will also
Expand Down
15 changes: 5 additions & 10 deletions api/src/main/java/com/rappytv/globaltags/api/GlobalTagAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,17 @@ public class GlobalTagAPI implements GlobalTagsAPI<Component> {
private final Cache<Component> cache = new Cache<>(this);
private final ApiHandler<Component> apiHandler = new ApiHandler<>(this);

private final Supplier<String> addonVersion;
private final Agent agent;
private final Supplier<String> language;

public GlobalTagAPI(Supplier<String> addonVersion, Supplier<String> language) {
this.addonVersion = addonVersion;
public GlobalTagAPI(Agent agent, Supplier<String> language) {
this.agent = agent;
this.language = language;
}

@Override
public @NotNull String getApiBase() {
return "https://gt.rappytv.com";
}

@Override
public @NotNull String getAgent() {
return "LabyAddon v" + addonVersion.get();
public @NotNull Agent getAgent() {
return agent;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

dependencies {
api(project(":api"))
maven(mavenCentral(), "com.rappytv.globaltags:GlobalTagsJava:1.0.3")
maven(mavenCentral(), "com.rappytv.globaltags:GlobalTagsJava:1.0.5")

// If you want to use external libraries, you can do that here.
// The dependencies that are specified here are loaded into your project but will also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.rappytv.globaltags.interaction.ReportBulletPoint;
import com.rappytv.globaltags.listener.ServerNavigationListener;
import com.rappytv.globaltags.nametag.CustomTag;
import com.rappytv.globaltags.wrapper.GlobalTagsAPI.Agent;
import net.labymod.api.Laby;
import net.labymod.api.addon.LabyAddon;
import net.labymod.api.client.component.Component;
Expand Down Expand Up @@ -43,7 +44,7 @@ protected void preConfigurationLoad() {
protected void enable() {
registerSettingCategory();
api = new GlobalTagAPI(
() -> addonInfo().getVersion(),
new Agent("LabyAddon", addonInfo().getVersion(), Laby.labyAPI().minecraft().getVersion()),
() -> configuration().localizedResponses().get()
? Laby.labyAPI().minecraft().options().getCurrentLanguage()
: "en_us"
Expand Down

0 comments on commit 12a04ff

Please sign in to comment.