Skip to content

Commit e45d43d

Browse files
committed
Various fixes
1 parent b276438 commit e45d43d

5 files changed

Lines changed: 29 additions & 20 deletions

File tree

src/main/java/com/simon816/chatui/impl/ImplementationConfig.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class ImplementationConfig {
1717

1818
private enum SupportedType {
19-
SPONGE("sponge") {
19+
SPONGE("Sponge") {
2020

2121
@Override
2222
protected ConfigEditTab.ActionHandler createHandler() {
@@ -84,7 +84,9 @@ private SupportedType(String id) {
8484
static {
8585
SupportedType type = null;
8686
for (SupportedType testType : SupportedType.values()) {
87-
if (Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getId().equals(testType.implId)) {
87+
if (Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getId().equals(testType.implId)
88+
// also check CommonName for spongecommon-based
89+
|| testType.implId.equals(Sponge.getPlatform().asMap().get("CommonName"))) {
8890
type = testType;
8991
break;
9092
}

src/main/java/com/simon816/chatui/impl/ImplementationPagination.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.simon816.chatui.impl;
22

3-
import org.spongepowered.api.Platform;
43
import org.spongepowered.api.Sponge;
54
import org.spongepowered.api.command.CommandSource;
65
import org.spongepowered.api.service.pagination.PaginationService;
@@ -10,7 +9,7 @@
109
public class ImplementationPagination {
1110

1211
public static void modify(PaginationService service, CommandSource oldSource, CommandSource newSource) {
13-
if (Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getId().equals("sponge")) {
12+
if (Sponge.getPlatform().asMap().get("CommonName").equals("Sponge")) {
1413
if (service instanceof SpongePaginationService) {
1514
SpongePaginationAccessor.replaceActivePagination((SpongePaginationService) service, oldSource, newSource);
1615
}

src/main/java/com/simon816/chatui/pagination/TabbedPaginationBuilder.java

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.simon816.chatui.lib.config.PlayerSettings;
44
import org.spongepowered.api.service.pagination.PaginationList;
5-
import org.spongepowered.api.service.pagination.PaginationList.Builder;
65
import org.spongepowered.api.service.pagination.PaginationService;
76
import org.spongepowered.api.text.Text;
87

@@ -22,47 +21,56 @@ public TabbedPaginationBuilder(PaginationService service) {
2221

2322
@Override
2423
public PaginationList.Builder contents(Iterable<Text> contents) {
25-
return this.builder.contents(contents);
24+
this.builder.contents(contents);
25+
return this;
2626
}
2727

2828
@Override
2929
public PaginationList.Builder contents(Text... contents) {
30-
return this.builder.contents(contents);
30+
this.builder.contents(contents);
31+
return this;
3132
}
3233

3334
@Override
3435
public PaginationList.Builder title(Text title) {
35-
return this.builder.title(title);
36+
this.builder.title(title);
37+
return this;
3638
}
3739

3840
@Override
3941
public PaginationList.Builder header(Text header) {
40-
return this.builder.header(header);
42+
this.builder.header(header);
43+
return this;
4144
}
4245

4346
@Override
4447
public PaginationList.Builder footer(Text footer) {
45-
return this.builder.footer(footer);
48+
this.builder.footer(footer);
49+
return this;
4650
}
4751

4852
@Override
49-
public Builder from(PaginationList value) {
50-
return this.builder.from(value);
53+
public PaginationList.Builder from(PaginationList value) {
54+
this.builder.from(value);
55+
return this;
5156
}
5257

5358
@Override
54-
public Builder reset() {
55-
return this.builder.reset();
59+
public PaginationList.Builder reset() {
60+
this.builder.reset();
61+
return this;
5662
}
5763

5864
@Override
59-
public Builder padding(Text padding) {
60-
return this.builder.padding(padding);
65+
public PaginationList.Builder padding(Text padding) {
66+
this.builder.padding(padding);
67+
return this;
6168
}
6269

6370
@Override
64-
public Builder linesPerPage(int linesPerPage) {
65-
return this.builder.linesPerPage(linesPerPage - this.removedHeight);
71+
public PaginationList.Builder linesPerPage(int linesPerPage) {
72+
this.builder.linesPerPage(linesPerPage - this.removedHeight);
73+
return this;
6674
}
6775

6876
@Override

src/main/java/com/simon816/chatui/tabs/perm/EntryDisplayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void draw(PlayerContext ctx, LineFactory lineFactory) {
150150
}, EntryDisplayer.this.tab)).build(),
151151
Text.builder(EntryDisplayer.this.addMode ? " [Cancel]" : " [Add]")
152152
.color(EntryDisplayer.this.addMode ? TextColors.RED : TextColors.GREEN)
153-
.onClick(ExtraUtils.clickAction(() -> EntryDisplayer.this.addMode = !EntryDisplayer.this.addMode,
153+
.onClick(ExtraUtils.clickAction((Runnable) () -> EntryDisplayer.this.addMode = !EntryDisplayer.this.addMode,
154154
EntryDisplayer.this.tab))
155155
.build(),
156156
Text.builder(" [Scroll Up]").color(EntryDisplayer.this.scroll.canScrollUp() ? TextColors.WHITE : TextColors.GRAY)

src/main/java/com/simon816/chatui/tabs/perm/SubjectListPane.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void draw(PlayerContext ctx, LineFactory lineFactory) {
6161
}, SubjectListPane.this.tab)).build(),
6262
Text.builder(SubjectListPane.this.addMode ? " [Cancel]" : " [Add]")
6363
.color(SubjectListPane.this.addMode ? TextColors.RED : TextColors.GREEN)
64-
.onClick(ExtraUtils.clickAction(() -> SubjectListPane.this.addMode = !SubjectListPane.this.addMode,
64+
.onClick(ExtraUtils.clickAction((Runnable) () -> SubjectListPane.this.addMode = !SubjectListPane.this.addMode,
6565
SubjectListPane.this.tab))
6666
.build(),
6767
Text.builder(" [Scroll Up]")

0 commit comments

Comments
 (0)