Skip to content

Commit

Permalink
Implement cross-proxy messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Brikster committed Dec 22, 2023
1 parent 1b95fba commit f8f6fd7
Show file tree
Hide file tree
Showing 63 changed files with 1,568 additions and 277 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ build/

!gradle-wrapper.jar

spigot/run/
spigot/run/
compose.yaml
6 changes: 3 additions & 3 deletions api/src/main/java/ru/brikster/chatty/api/chat/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
public interface Chat {

/**
* Name of chat from plugin configuration
* ID of chat from plugin configuration
*
* @return name of chat
* @return ID of chat
*/
@NotNull
String getName();
String getId();

@NotNull
String getDisplayName();
Expand Down
8 changes: 8 additions & 0 deletions spigot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ tasks {
relocations.forEach {
relocate it, "ru.brikster.chatty.shaded.${it}"
}
mergeServiceFiles {
setPath("META-INF/services/org.flywaydb.core.extensibility.Plugin")
}
}

build {
Expand Down Expand Up @@ -66,6 +69,11 @@ dependencies {

implementation 'com.zaxxer:HikariCP:5.1.0'
implementation 'org.flywaydb:flyway-core:9.22.3'
implementation 'org.flywaydb:flyway-mysql:9.22.3'
implementation 'org.postgresql:postgresql:42.7.1'
implementation('org.redisson:redisson:3.25.1') {
exclude group: 'org.yaml'
}

compileOnly 'net.milkbowl.vault:VaultAPI:1.7'
compileOnly 'me.clip:placeholderapi:2.10.6'
Expand Down
6 changes: 3 additions & 3 deletions spigot/src/main/java/ru/brikster/chatty/Chatty.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import ru.brikster.chatty.command.CommandSuggestionsProvider;
import ru.brikster.chatty.command.ProxyingCommandHandler;
import ru.brikster.chatty.command.ProxyingCommandSuggestionsProvider;
import ru.brikster.chatty.config.type.MessagesConfig;
import ru.brikster.chatty.config.type.PmConfig;
import ru.brikster.chatty.config.type.SettingsConfig;
import ru.brikster.chatty.config.file.MessagesConfig;
import ru.brikster.chatty.config.file.PmConfig;
import ru.brikster.chatty.config.file.SettingsConfig;
import ru.brikster.chatty.guice.ConfigsLoader;
import ru.brikster.chatty.guice.GeneralGuiceModule;
import ru.brikster.chatty.misc.VanillaListener;
Expand Down
32 changes: 16 additions & 16 deletions spigot/src/main/java/ru/brikster/chatty/chat/ChatImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public final class ChatImpl implements Chat {

@Getter
private final @NotNull String name;
private final @NotNull String id;
private final @Nullable String displayName;

@Getter
Expand Down Expand Up @@ -74,7 +74,7 @@ public final class ChatImpl implements Chat {
@Override
public @NotNull String getDisplayName() {
return displayName == null
? name
? id
: displayName;
}

Expand All @@ -95,33 +95,33 @@ public boolean removeStrategy(@NotNull MessageTransformStrategy<?> strategy) {

@Override
public boolean hasSymbolWritePermission(Player sender) {
return sender.hasPermission("chatty.chat." + getName())
|| sender.hasPermission("chatty.chat." + getName() + ".write")
|| sender.hasPermission("chatty.chat." + getName() + ".send")
|| sender.hasPermission("chatty.chat." + getName() + ".write.symbol")
|| sender.hasPermission("chatty.chat." + getName() + ".send.symbol");
return sender.hasPermission("chatty.chat." + getId())
|| sender.hasPermission("chatty.chat." + getId() + ".write")
|| sender.hasPermission("chatty.chat." + getId() + ".send")
|| sender.hasPermission("chatty.chat." + getId() + ".write.symbol")
|| sender.hasPermission("chatty.chat." + getId() + ".send.symbol");
}

@Override
public boolean hasCommandWritePermission(Player sender) {
return sender.hasPermission("chatty.chat." + getName())
|| sender.hasPermission("chatty.chat." + getName() + ".write")
|| sender.hasPermission("chatty.chat." + getName() + ".send")
|| sender.hasPermission("chatty.chat." + getName() + ".write.command")
|| sender.hasPermission("chatty.chat." + getName() + ".send.command");
return sender.hasPermission("chatty.chat." + getId())
|| sender.hasPermission("chatty.chat." + getId() + ".write")
|| sender.hasPermission("chatty.chat." + getId() + ".send")
|| sender.hasPermission("chatty.chat." + getId() + ".write.command")
|| sender.hasPermission("chatty.chat." + getId() + ".send.command");
}

@Override
public boolean hasReadPermission(Player sender) {
return sender.hasPermission("chatty.chat." + getName())
|| sender.hasPermission("chatty.chat." + getName() + ".read")
|| sender.hasPermission("chatty.chat." + getName() + ".see");
return sender.hasPermission("chatty.chat." + getId())
|| sender.hasPermission("chatty.chat." + getId() + ".read")
|| sender.hasPermission("chatty.chat." + getId() + ".see");
}

@Override
public @NotNull Predicate<Player> getRecipientPredicate(@Nullable Player sender) {
return player -> {
if (player.equals(sender)) {
if (player == sender || player.equals(sender)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.entity.Player;
import org.bukkit.OfflinePlayer;

@Getter
@RequiredArgsConstructor(staticName = "of")
public final class SinglePlayerTransformContext implements TransformContext {

private final Player player;
private final OfflinePlayer player;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.jetbrains.annotations.NotNull;
import ru.brikster.chatty.chat.component.ComponentTransformer;
import ru.brikster.chatty.chat.component.context.SinglePlayerTransformContext;
import ru.brikster.chatty.config.type.SettingsConfig;
import ru.brikster.chatty.config.file.SettingsConfig;
import ru.brikster.chatty.convert.component.ComponentStringConverter;
import ru.brikster.chatty.util.AdventureUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.jetbrains.annotations.NotNull;
import ru.brikster.chatty.Constants;
import ru.brikster.chatty.chat.component.context.SinglePlayerTransformContext;
import ru.brikster.chatty.config.type.ReplacementsConfig;
import ru.brikster.chatty.config.file.ReplacementsConfig;
import ru.brikster.chatty.convert.component.ComponentStringConverter;
import ru.brikster.chatty.util.AdventureUtil;

Expand Down
Loading

0 comments on commit f8f6fd7

Please sign in to comment.