Skip to content

Commit 9249c73

Browse files
Fully move to dynamic commands
1 parent 7e020e2 commit 9249c73

File tree

6 files changed

+17
-44
lines changed

6 files changed

+17
-44
lines changed

.idea/ServerLinksZ.iml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.strassburger</groupId>
88
<artifactId>ServerLinksZ</artifactId>
9-
<version>1.2.0</version>
9+
<version>1.3.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>ServerLinksZ</name>

src/main/java/com/zetaplugins/serverlinksz/util/CommandManager.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
public class CommandManager {
2020
private final ServerLinksZ plugin;
21-
private final List<String> defaultLinkCommands = List.of(
22-
"discord", "website", "store", "teamspeak", "twitter", "youtube", "instagram", "facebook", "tiktok", "vote"
23-
);
2421

2522
public CommandManager(ServerLinksZ plugin) {
2623
this.plugin = plugin;
@@ -63,19 +60,14 @@ public void registerCommands() {
6360
registerCommand("link", new LinkCommand(plugin), new LinkCommand(plugin));
6461
}
6562

66-
for (String linkCommand : defaultLinkCommands) {
67-
registerCommand(linkCommand, new LinkCommand(plugin), new LinkCommand(plugin));
68-
}
69-
7063
CommandMap commandMap = getCommandMap();
7164

72-
if (commandMap == null || !plugin.getConfig().getBoolean("dynamicCommands")) return;
65+
if (commandMap == null) return;
7366

7467
for (String linkKey : plugin.getLinkManager().getLinkKeys()) {
75-
if (defaultLinkCommands.contains(linkKey)) continue;
7668
LinkManager.Link link = plugin.getLinkManager().getLink(linkKey);
7769
if (link == null || !link.allowCommand()) continue;
78-
commandMap.register(linkKey, link.getCommand());
70+
commandMap.register(linkKey, "slzcmd", link.getCommand());
7971
}
8072
}
8173

src/main/resources/config.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ hints: true
2828
# Add a /link command to view the links
2929
linkCommand: true
3030

31-
# Instead of using the /link command, you can also use a custom command for any link (e.g. /mycoollink)
32-
# This feature is experimental and might not work as expected
33-
dynamicCommands: false
34-
3531
# [!!!] You can configure the links in the links.yml file!

src/main/resources/plugin.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,6 @@ commands:
1818
permission: serverlinksz.admin
1919
link:
2020
description: Get a link
21-
discord:
22-
description: Get the discord link
23-
aliases:
24-
- dc
25-
website:
26-
description: Get the website link
27-
store:
28-
description: Get the store link
29-
teamspeak:
30-
description: Get the teamspeak link
31-
aliases:
32-
- ts
33-
youtube:
34-
description: Get the youtube link
35-
aliases:
36-
- yt
37-
twitter:
38-
description: Get the twitter link
39-
instagram:
40-
description: Get the instagram link
41-
aliases:
42-
- insta
43-
facebook:
44-
description: Get the facebook link
45-
tiktok:
46-
description: Get the tiktok link
47-
vote:
48-
description: Get the vote link
4921

5022
permissions:
5123
serverlinksz.admin:

0 commit comments

Comments
 (0)