Skip to content

Commit

Permalink
Release v1.3.4 (#68)
Browse files Browse the repository at this point in the history
Implement staff note management and tag history ingame
  • Loading branch information
RappyTV authored Nov 24, 2024
2 parents d37b391 + 77182d1 commit 2cfcabe
Show file tree
Hide file tree
Showing 25 changed files with 1,119 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Build with Gradle
run: ./gradlew build --full-stacktrace
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/*-release.jar
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtensi
dependencies {
labyProcessor()
labyApi("api")
addonMavenDependency("com.rappytv.globaltags:GlobalTagsJava:1.1.8")
addonMavenDependency("com.rappytv.globaltags:GlobalTagsJava:1.1.9")
}

labyModAnnotationProcessor {
Expand Down
9 changes: 7 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";")
group = "org.example"
version = providers.environmentVariable("VERSION").getOrElse("1.3.3")
version = providers.environmentVariable("VERSION").getOrElse("1.3.4")

labyMod {
defaultPackageName = "com.rappytv.globaltags" //change this to your main package name (used by all modules)
Expand All @@ -32,6 +32,11 @@ labyMod {
subprojects {
plugins.apply("net.labymod.labygradle")
plugins.apply("net.labymod.labygradle.addon")

group = rootProject.group
version = rootProject.version
}

repositories {
maven("https://repo.rappytv.com/public/")
}
}
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtensi
dependencies {
labyProcessor()
api(project(":api"))
addonMavenDependency("com.rappytv.globaltags:GlobalTagsJava:1.1.8")
addonMavenDependency("com.rappytv.globaltags:GlobalTagsJava:1.1.9")
}

labyModAnnotationProcessor {
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/com/rappytv/globaltags/GlobalTagAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.rappytv.globaltags.config.GlobalTagConfig;
import com.rappytv.globaltags.interaction.EditBanInfoBulletPoint;
import com.rappytv.globaltags.interaction.ReferPlayerBulletPoint;
import com.rappytv.globaltags.interaction.StaffNotesBulletPoint;
import com.rappytv.globaltags.interaction.TagHistoryBulletPoint;
import com.rappytv.globaltags.interaction.ToggleBanBulletPoint;
import com.rappytv.globaltags.interaction.ChangeTagBulletPoint;
import com.rappytv.globaltags.interaction.ClearTagBulletPoint;
Expand Down Expand Up @@ -66,6 +68,8 @@ protected void enable() {
labyAPI().interactionMenuRegistry().register(new EditBanInfoBulletPoint());
labyAPI().interactionMenuRegistry().register(new ReferPlayerBulletPoint());
labyAPI().interactionMenuRegistry().register(new ReportBulletPoint());
labyAPI().interactionMenuRegistry().register(new StaffNotesBulletPoint());
labyAPI().interactionMenuRegistry().register(new TagHistoryBulletPoint());
labyAPI().interactionMenuRegistry().register(new ToggleBanBulletPoint());
registerCommand(new GlobalTagCommand(this));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.rappytv.globaltags.activities;

import com.rappytv.globaltags.GlobalTagAddon;
import com.rappytv.globaltags.api.GlobalTagAPI;
import com.rappytv.globaltags.api.Util;
import java.util.UUID;
import net.labymod.api.Laby;
import net.labymod.api.client.component.Component;
import net.labymod.api.client.component.format.NamedTextColor;
import net.labymod.api.client.gui.icon.Icon;
import net.labymod.api.client.gui.screen.Parent;
import net.labymod.api.client.gui.screen.ScreenInstance;
import net.labymod.api.client.gui.screen.activity.AutoActivity;
import net.labymod.api.client.gui.screen.activity.Link;
import net.labymod.api.client.gui.screen.activity.types.SimpleActivity;
import net.labymod.api.client.gui.screen.widget.Widget;
import net.labymod.api.client.gui.screen.widget.widgets.ComponentWidget;
import net.labymod.api.client.gui.screen.widget.widgets.input.ButtonWidget;
import net.labymod.api.client.gui.screen.widget.widgets.input.TextFieldWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.FlexibleContentWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.list.HorizontalListWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.list.VerticalListWidget;
import net.labymod.api.client.gui.screen.widget.widgets.renderer.IconWidget;

@Link("input.lss")
@AutoActivity
public class CreateNoteActivity extends SimpleActivity {

private final GlobalTagAPI api;
private final UUID uuid;
private final String username;

public CreateNoteActivity(GlobalTagAPI api, UUID uuid, String username) {
this.api = api;
this.uuid = uuid;
this.username = username;
}

@Override
public void initialize(Parent parent) {
super.initialize(parent);
FlexibleContentWidget windowWidget = new FlexibleContentWidget().addId("window");
HorizontalListWidget profileWrapper = new HorizontalListWidget().addId("header");
IconWidget headWidget = new IconWidget(Icon.head(this.uuid)).addId("head");
ComponentWidget titleWidget = ComponentWidget.i18n("globaltags.context.staff_notes.create.title", this.username).addId("username");
VerticalListWidget<Widget> content = new VerticalListWidget<>().addId("content");
ComponentWidget labelWidget = ComponentWidget.i18n("globaltags.context.staff_notes.create.label").addId("label");
TextFieldWidget inputWidget = new TextFieldWidget()
.placeholder(Component.translatable("globaltags.context.staff_notes.create.placeholder", NamedTextColor.DARK_GRAY))
.addId("input");
ButtonWidget sendButton = new ButtonWidget()
.updateComponent(Component.translatable("globaltags.context.staff_notes.create.send", NamedTextColor.AQUA))
.addId("send-button");
sendButton.setEnabled(false);
sendButton.setActionListener(() -> api.getApiHandler().createNote(uuid, inputWidget.getText(), (response) -> {
Laby.references().chatExecutor().displayClientMessage(
Component.empty()
.append(GlobalTagAddon.prefix)
.append(Util.getResponseComponent(response))
);
Laby.labyAPI().minecraft().executeOnRenderThread(() ->
Laby.labyAPI().minecraft().minecraftWindow().displayScreen((ScreenInstance) null)
);
}));
inputWidget.updateListener((text) -> sendButton.setEnabled(!text.isBlank()));

profileWrapper.addEntry(headWidget);
profileWrapper.addEntry(titleWidget);

content.addChild(labelWidget);
content.addChild(inputWidget);
content.addChild(sendButton);

windowWidget.addContent(profileWrapper);
windowWidget.addContent(content);
this.document.addChild(windowWidget);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.rappytv.globaltags.activities;

import com.rappytv.globaltags.GlobalTagAddon;
import com.rappytv.globaltags.activities.widgets.StaffNoteWidget;
import com.rappytv.globaltags.api.GlobalTagAPI;
import com.rappytv.globaltags.wrapper.model.PlayerNote;
import net.labymod.api.Laby;
import net.labymod.api.client.component.Component;
import net.labymod.api.client.component.TextComponent;
import net.labymod.api.client.component.format.NamedTextColor;
import net.labymod.api.client.gui.icon.Icon;
import net.labymod.api.client.gui.screen.Parent;
import net.labymod.api.client.gui.screen.ScreenInstance;
import net.labymod.api.client.gui.screen.activity.AutoActivity;
import net.labymod.api.client.gui.screen.activity.Link;
import net.labymod.api.client.gui.screen.activity.types.SimpleActivity;
import net.labymod.api.client.gui.screen.widget.widgets.ComponentWidget;
import net.labymod.api.client.gui.screen.widget.widgets.input.ButtonWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.FlexibleContentWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.ScrollWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.list.HorizontalListWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.list.VerticalListWidget;
import net.labymod.api.client.gui.screen.widget.widgets.renderer.IconWidget;
import java.util.UUID;

@Link("list.lss")
@AutoActivity
public class StaffNotesActivity extends SimpleActivity {

private final GlobalTagAPI api;
private final UUID uuid;
private final String username;

public StaffNotesActivity(GlobalTagAPI api, UUID uuid, String username) {
this.api = api;
this.uuid = uuid;
this.username = username;
}

@Override
public void initialize(Parent parent) {
super.initialize(parent);
api.getApiHandler().getNotes(uuid, (response) -> Laby.labyAPI().minecraft().executeOnRenderThread(() -> {
if(document.getChild("window") != null) return;
if(!response.successful()) {
Laby.references().chatExecutor().displayClientMessage(
TextComponent.builder()
.append(GlobalTagAddon.prefix)
.append(Component.text(response.error(), NamedTextColor.RED))
.build()
);
Laby.labyAPI().minecraft().minecraftWindow().displayScreen((ScreenInstance) null);
return;
}
FlexibleContentWidget windowWidget = new FlexibleContentWidget().addId("window");
HorizontalListWidget profileWrapper = new HorizontalListWidget().addId("header");
ButtonWidget createButton = ButtonWidget
.text("+", () -> Laby.labyAPI().minecraft().minecraftWindow().displayScreen(
new CreateNoteActivity(api, uuid, username)
))
.addId("create-button");
createButton.setHoverComponent(Component.translatable("globaltags.context.staff_notes.hover.create"));
IconWidget headWidget = new IconWidget(Icon.head(this.uuid)).addId("head");
ComponentWidget titleWidget = ComponentWidget.i18n("globaltags.context.staff_notes.title", this.username).addId("username");
VerticalListWidget<StaffNoteWidget> notes = new VerticalListWidget<>().addId("item-list");
for (PlayerNote note : response.data()) {
notes.addChild(new StaffNoteWidget(uuid, api, note));
}

profileWrapper.addEntryInitialized(headWidget);
profileWrapper.addEntryInitialized(titleWidget);
profileWrapper.addEntryInitialized(createButton);

windowWidget.addContentInitialized(profileWrapper);
windowWidget.addContentInitialized(new ScrollWidget(notes));
this.document.addChildInitialized(windowWidget);
}));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.rappytv.globaltags.activities;

import com.rappytv.globaltags.GlobalTagAddon;
import com.rappytv.globaltags.activities.widgets.TagHistoryEntryWidget;
import com.rappytv.globaltags.api.GlobalTagAPI;
import net.labymod.api.Laby;
import net.labymod.api.client.component.Component;
import net.labymod.api.client.component.TextComponent;
import net.labymod.api.client.component.format.NamedTextColor;
import net.labymod.api.client.gui.icon.Icon;
import net.labymod.api.client.gui.screen.Parent;
import net.labymod.api.client.gui.screen.ScreenInstance;
import net.labymod.api.client.gui.screen.activity.AutoActivity;
import net.labymod.api.client.gui.screen.activity.Link;
import net.labymod.api.client.gui.screen.activity.types.SimpleActivity;
import net.labymod.api.client.gui.screen.widget.widgets.ComponentWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.FlexibleContentWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.ScrollWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.list.HorizontalListWidget;
import net.labymod.api.client.gui.screen.widget.widgets.layout.list.VerticalListWidget;
import net.labymod.api.client.gui.screen.widget.widgets.renderer.IconWidget;

import java.util.UUID;

@Link("list.lss")
@AutoActivity
public class TagHistoryActivity extends SimpleActivity {

private final GlobalTagAPI api;
private final UUID uuid;
private final String username;

public TagHistoryActivity(GlobalTagAPI api, UUID uuid, String username) {
this.api = api;
this.uuid = uuid;
this.username = username;
}

@Override
public void initialize(Parent parent) {
super.initialize(parent);
api.getApiHandler().getTagHistory(uuid, (response) -> Laby.labyAPI().minecraft().executeOnRenderThread(() -> {
if(document.getChild("window") != null) return;
System.out.println(response.data());
if(!response.successful()) {
Laby.references().chatExecutor().displayClientMessage(
TextComponent.builder()
.append(GlobalTagAddon.prefix)
.append(Component.text(response.error(), NamedTextColor.RED))
.build()
);
Laby.labyAPI().minecraft().minecraftWindow().displayScreen((ScreenInstance) null);
return;
}
FlexibleContentWidget windowWidget = new FlexibleContentWidget().addId("window");
HorizontalListWidget profileWrapper = new HorizontalListWidget().addId("header");
IconWidget headWidget = new IconWidget(Icon.head(this.uuid)).addId("head");
ComponentWidget titleWidget = ComponentWidget.i18n("globaltags.context.tag_history.title", this.username).addId("username");
VerticalListWidget<TagHistoryEntryWidget> notes = new VerticalListWidget<>().addId("item-list");
for(int i = 0; i < response.data().size(); i++) {
notes.addChild(new TagHistoryEntryWidget(i + 1, api, response.data().get(i)));
}

profileWrapper.addEntryInitialized(headWidget);
profileWrapper.addEntryInitialized(titleWidget);

windowWidget.addContentInitialized(profileWrapper);
windowWidget.addContentInitialized(new ScrollWidget(notes));
this.document.addChildInitialized(windowWidget);
}));
}
}
Loading

0 comments on commit 2cfcabe

Please sign in to comment.