Skip to content

Commit 7845cba

Browse files
authored
Fix help.yml index-topics not working for non-console senders (#13193)
1 parent 952a024 commit 7845cba

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

paper-server/src/main/java/org/bukkit/craftbukkit/help/CustomIndexHelpTopic.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.bukkit.help.HelpMap;
88
import org.bukkit.help.HelpTopic;
99
import org.bukkit.help.IndexHelpTopic;
10+
import org.jetbrains.annotations.NotNull;
1011

1112
public class CustomIndexHelpTopic extends IndexHelpTopic {
1213
private List<String> futureTopics;
@@ -18,8 +19,21 @@ public CustomIndexHelpTopic(HelpMap helpMap, String name, String shortText, Stri
1819
this.futureTopics = futureTopics;
1920
}
2021

22+
@Override
23+
public boolean canSee(@NotNull final CommandSender sender) {
24+
this.computeTopics();
25+
26+
return super.canSee(sender);
27+
}
28+
2129
@Override
2230
public String getFullText(CommandSender sender) {
31+
this.computeTopics();
32+
33+
return super.getFullText(sender);
34+
}
35+
36+
private void computeTopics() {
2337
if (this.futureTopics != null) {
2438
List<HelpTopic> topics = new LinkedList<>();
2539
for (String futureTopic : this.futureTopics) {
@@ -31,7 +45,5 @@ public String getFullText(CommandSender sender) {
3145
this.setTopicsCollection(topics);
3246
this.futureTopics = null;
3347
}
34-
35-
return super.getFullText(sender);
3648
}
3749
}

0 commit comments

Comments
 (0)