@@ -50,7 +50,7 @@ public class GlobalLinkServer extends JavaPlugin implements Listener {
50
50
.append (Component .text ("`/link`" , NamedTextColor .GREEN ))
51
51
.append (Component .text (" command to link your accounts." , NamedTextColor .AQUA ));
52
52
53
- public final static Component UNLINK_INSTRUCTIONS = Component .text ("To unlink, use " ).color (NamedTextColor .AQUA )
53
+ public final static Component UNLINK_INSTRUCTIONS = Component .text ("You are currently linked. To unlink, use " ).color (NamedTextColor .AQUA )
54
54
.append (Component .text ("`/unlink`" , NamedTextColor .RED ))
55
55
.append (Component .text ("." ));
56
56
@@ -152,6 +152,10 @@ public void onCommands(PlayerCommandSendEvent event) {
152
152
continue ;
153
153
}
154
154
155
+ if (command .contains ("help" )) {
156
+ continue ;
157
+ }
158
+
155
159
toRemove .add (command );
156
160
}
157
161
@@ -161,7 +165,8 @@ public void onCommands(PlayerCommandSendEvent event) {
161
165
162
166
@ EventHandler
163
167
public void preCommand (PlayerCommandPreprocessEvent event ) {
164
- if (event .getPlayer ().isOp ()) {
168
+ Player player = event .getPlayer ();
169
+ if (player .isOp ()) {
165
170
return ;
166
171
}
167
172
@@ -170,6 +175,15 @@ public void preCommand(PlayerCommandPreprocessEvent event) {
170
175
command = command .substring (1 );
171
176
}
172
177
178
+ if (command .equalsIgnoreCase ("help" )) {
179
+ event .setCancelled (true );
180
+ if (Utils .isLinked (player )) {
181
+ player .sendMessage (UNLINK_INSTRUCTIONS );
182
+ } else {
183
+ player .sendMessage (LINK_INSTRUCTIONS );
184
+ }
185
+ }
186
+
173
187
if (!permittedCommands .contains (command )) {
174
188
event .setCancelled (true );
175
189
}
0 commit comments