Skip to content

Commit 7cb48a9

Browse files
authored
Merge pull request HelpChat#143 from BlitzOffline/feature/api-redesign
2 parents 7bfc30c + 4849c13 commit 7cb48a9

File tree

121 files changed

+2504
-802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+2504
-802
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
.gradle
33
build
4+
test-module

api/build.gradle.kts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
13
plugins {
24
id("chatchat.base-conventions")
35
id("maven-publish")
6+
id("com.github.johnrengelman.shadow") version "7.1.2"
47
}
58

69
dependencies {
7-
compileOnly(libs.adventure.bukkit)
10+
api(libs.adventure.bukkit)
11+
api(libs.adventure.minimessage)
12+
api(libs.adventure.configurate)
13+
814
compileOnly(libs.spigot)
915
}
1016

1117
publishing {
1218

1319
}
20+
21+
tasks {
22+
withType<ShadowJar> {
23+
listOf("net.kyori",
24+
"io.leangen",
25+
).forEach { relocate(it, "at.helpch.chatchat.libs.$it") }
26+
}
27+
}

api/src/main/java/at/helpch/chatchat/api/Channel.java

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package at.helpch.chatchat.api;
2+
3+
import at.helpch.chatchat.api.channel.ChannelTypeRegistry;
4+
import at.helpch.chatchat.api.hook.HookManager;
5+
import at.helpch.chatchat.api.mention.MentionManager;
6+
import at.helpch.chatchat.api.placeholder.MiniPlaceholderManager;
7+
import at.helpch.chatchat.api.rule.RuleManager;
8+
import at.helpch.chatchat.api.user.UsersHolder;
9+
import org.jetbrains.annotations.NotNull;
10+
11+
public interface ChatChatAPI {
12+
13+
/**
14+
* Get the {@link UsersHolder}
15+
*
16+
* @return The {@link UsersHolder}
17+
*/
18+
@NotNull UsersHolder usersHolder();
19+
20+
/**
21+
* Get the {@link HookManager}
22+
*
23+
* @return The {@link HookManager}
24+
*/
25+
@NotNull HookManager hookManager();
26+
27+
/**
28+
* Get the {@link ChannelTypeRegistry}
29+
*
30+
* @return The {@link ChannelTypeRegistry}
31+
*/
32+
@NotNull ChannelTypeRegistry channelTypeRegistry();
33+
34+
/**
35+
* Get the {@link RuleManager}
36+
*
37+
* @return The {@link RuleManager}
38+
*/
39+
@NotNull RuleManager ruleManager();
40+
41+
/**
42+
* Get the {@link MentionManager}
43+
*
44+
* @return The {@link MentionManager}
45+
*/
46+
@NotNull MentionManager mentionsManager();
47+
48+
/**
49+
* Get the {@link MiniPlaceholderManager}
50+
*
51+
* @return The {@link MiniPlaceholderManager}
52+
*/
53+
@NotNull MiniPlaceholderManager miniPlaceholdersManager();
54+
}

api/src/main/java/at/helpch/chatchat/api/ChatUser.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

api/src/main/java/at/helpch/chatchat/api/Format.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

api/src/main/java/at/helpch/chatchat/api/MentionType.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

api/src/main/java/at/helpch/chatchat/api/PriorityFormat.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

api/src/main/java/at/helpch/chatchat/api/User.java

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package at.helpch.chatchat.api.channel;
2+
3+
import at.helpch.chatchat.api.holder.FormatsHolder;
4+
import at.helpch.chatchat.api.user.ChatUser;
5+
import at.helpch.chatchat.api.user.User;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
import java.util.List;
9+
import java.util.Set;
10+
11+
/**
12+
* Represents a channel.
13+
*/
14+
public interface Channel {
15+
16+
/**
17+
* Get the name of the channel.
18+
*
19+
* @return The name of the channel.
20+
*/
21+
@NotNull String name();
22+
23+
/**
24+
* Get the message prefix of the channel. This prefix can be used at the start of a message to automatically send
25+
* the message in this channel instead of having the {@link User} switch the channel first.
26+
*
27+
* @return The message prefix of the channel.
28+
*/
29+
@NotNull String messagePrefix();
30+
31+
/**
32+
* Get the channel prefix of this channel. This is for display purposes.
33+
*
34+
* @return The channel prefix of this channel.
35+
*/
36+
@NotNull String channelPrefix();
37+
38+
/**
39+
* Get a list of commands that can be used to switch to this channel.
40+
*
41+
* @return The commands that can be used to switch to this channel.
42+
*/
43+
@NotNull List<String> commandNames();
44+
45+
/**
46+
* Get a {@link FormatsHolder} that contains a list of formats that are associated with this channel. The list can
47+
* be empty, but any format in the list will take precedence over global formats.
48+
*
49+
* @return The formats associated with this channel.
50+
*/
51+
@NotNull FormatsHolder formats();
52+
53+
/**
54+
* Get the radius of this channel. Radius can be set to -1 to be disabled.
55+
*
56+
* @return The radius of this channel.
57+
*/
58+
int radius();
59+
60+
/**
61+
* Get a set of {@link ChatUser}s that can see this channel.
62+
*
63+
* @param source The {@link User} that is requesting the list.
64+
* @return The {@link ChatUser}s that can see this channel.
65+
*/
66+
Set<User> targets(@NotNull final User source);
67+
68+
/**
69+
* Get a set of {@link ChatUser}s that can send messages in this channel.
70+
*
71+
* @param user The {@link User} that is requesting the list.
72+
* @return The {@link ChatUser}s that can send messages in this channel.
73+
*/
74+
boolean isUsableBy(@NotNull final ChatUser user);
75+
}

0 commit comments

Comments
 (0)