Merge branch 'main' into vote_mute
This commit is contained in:
commit
3275db13d0
20
Jenkinsfile
vendored
Normal file
20
Jenkinsfile
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Gradle') {
|
||||
steps {
|
||||
sh './gradlew build'
|
||||
}
|
||||
}
|
||||
stage('Archive') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'build/libs/', followSymlinks: false
|
||||
}
|
||||
}
|
||||
stage('discord') {
|
||||
steps {
|
||||
discordSend description: "Build: ${BUILD_NUMBER}", showChangeset: true, result: currentBuild.currentResult, title: currentBuild.fullProjectName, webhookURL: env.discordwebhook
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ plugins {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.alttd:Galaxy-API:1.19.2-R0.1-SNAPSHOT") {
|
||||
compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") {
|
||||
// exclude("net.kyori")
|
||||
}
|
||||
compileOnly("org.spongepowered:configurate-yaml:4.1.2") // Configurate
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public final class Config {
|
|||
|
||||
public static File CONFIGPATH;
|
||||
public static void init() {
|
||||
CONFIGPATH = new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "ChatPlugin");
|
||||
CONFIGPATH = new File(File.separator + "mnt" + File.separator + "configs" + File.separator + "ChatPlugin");
|
||||
CONFIG_FILE = new File(CONFIGPATH, "config.yml");
|
||||
configLoader = YamlConfigurationLoader.builder()
|
||||
.file(CONFIG_FILE)
|
||||
|
|
|
|||
|
|
@ -1,25 +1,12 @@
|
|||
plugins {
|
||||
`java-library`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.0"
|
||||
id("io.github.goooler.shadow") version "8.1.8"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = "com.alttd.chat"
|
||||
version = "2.0.0-SNAPSHOT"
|
||||
description = "All in one minecraft chat plugin"
|
||||
|
||||
// repositories {
|
||||
// mavenCentral()
|
||||
// maven("https://repo.destro.xyz/snapshots") // Altitude - Galaxy
|
||||
// maven("https://oss.sonatype.org/content/groups/public/") // Adventure
|
||||
// maven("https://oss.sonatype.org/content/repositories/snapshots/") // Minimessage
|
||||
// maven("https://oss.sonatype.org/content/repositories/") // Minimessage
|
||||
// maven("https://nexus.velocitypowered.com/repository/") // Velocity
|
||||
// maven("https://nexus.velocitypowered.com/repository/maven-public/") // Velocity
|
||||
// maven("https://repo.spongepowered.org/maven") // Configurate
|
||||
// maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") // Papi
|
||||
// maven("https://jitpack.io")
|
||||
// }
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
|
@ -27,7 +14,7 @@ subprojects {
|
|||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,58 +1,24 @@
|
|||
import java.io.FileOutputStream
|
||||
import java.net.URL
|
||||
|
||||
plugins {
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("xyz.jpenilla.run-paper") version "1.0.6"
|
||||
id("io.github.goooler.shadow")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":api")) // API
|
||||
compileOnly("com.alttd:Galaxy-API:1.20.4-R0.1-SNAPSHOT") // Galaxy
|
||||
compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") // Galaxy
|
||||
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5") // move to proxy
|
||||
compileOnly("org.apache.commons:commons-lang3:3.12.0") // needs an alternative, already removed from upstream api and will be removed in server
|
||||
compileOnly("net.luckperms:api:5.3") // Luckperms
|
||||
compileOnly(files("../libs/CMI.jar"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
shadowJar {
|
||||
archiveFileName.set("${rootProject.name}-${project.name}-${project.version}.jar")
|
||||
// minimize()
|
||||
}
|
||||
|
||||
build {
|
||||
// setBuildDir("${rootProject.buildDir}")
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
runServer {
|
||||
val dir = File(System.getProperty("user.home") + "/share/devserver/");
|
||||
if (!dir.parentFile.exists()) {
|
||||
dir.parentFile.mkdirs()
|
||||
}
|
||||
runDirectory.set(dir)
|
||||
|
||||
val fileName = "/galaxy.jar"
|
||||
var file = File(dir.path + fileName)
|
||||
|
||||
if (!file.parentFile.exists()) {
|
||||
file.parentFile.mkdirs()
|
||||
}
|
||||
if (!file.exists()) {
|
||||
download("https://repo.destro.xyz/snapshots/com/alttd/Galaxy-Server/Galaxy-paperclip-1.19.2-R0.1-SNAPSHOT-reobf.jar", file)
|
||||
}
|
||||
serverJar(file)
|
||||
minecraftVersion("1.19.2")
|
||||
}
|
||||
}
|
||||
|
||||
fun download(link: String, path: File) {
|
||||
URL(link).openStream().use { input ->
|
||||
FileOutputStream(path).use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -82,11 +82,6 @@ public class ChatListener implements Listener {
|
|||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Set<Player> receivers = event.viewers().stream().filter(audience -> audience instanceof Player)
|
||||
.map(audience -> (Player) audience)
|
||||
.filter(receiver -> !ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Component input = event.message().colorIfAbsent(NamedTextColor.WHITE);
|
||||
|
||||
ModifiableString modifiableString = new ModifiableString(input);
|
||||
|
|
@ -112,6 +107,11 @@ public class ChatListener implements Listener {
|
|||
return; // the message was blocked
|
||||
}
|
||||
|
||||
Set<Player> receivers = event.viewers().stream().filter(audience -> audience instanceof Player)
|
||||
.map(audience -> (Player) audience)
|
||||
.filter(receiver -> !ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<Player> playersToPing = new HashSet<>();
|
||||
pingPlayers(playersToPing, modifiableString, player);
|
||||
|
||||
|
|
@ -136,11 +136,12 @@ public class ChatListener implements Listener {
|
|||
Pattern nickPattern = Pattern.compile("\\b(?<!\\\\)" + nickName + "\\b", Pattern.CASE_INSENSITIVE);
|
||||
// Pattern escapedNickPattern = Pattern.compile("\\b\\\\" + nickName + "\\b", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
ChatUser onlinePlayerUser = ChatUserManager.getChatUser(onlinePlayer.getUniqueId());
|
||||
if (namePattern.matcher(modifiableString.string()).find()) {
|
||||
modifiableString.replace(TextReplacementConfig.builder()
|
||||
.once()
|
||||
.match(namePattern)
|
||||
.replacement(mention.append(onlinePlayer.displayName()))
|
||||
.replacement(mention.append(onlinePlayerUser.getDisplayName()))
|
||||
.build());
|
||||
//TODO replace all instances of \name with just name but using the match result so the capitalization doesn't change
|
||||
// modifiableString.replace(TextReplacementConfig.builder()
|
||||
|
|
@ -156,7 +157,7 @@ public class ChatListener implements Listener {
|
|||
modifiableString.replace(TextReplacementConfig.builder()
|
||||
.once()
|
||||
.match(nickPattern)
|
||||
.replacement(mention.append(onlinePlayer.displayName()))
|
||||
.replacement(mention.append(onlinePlayerUser.getDisplayName()))
|
||||
.build());
|
||||
if (!ChatUserManager.getChatUser(onlinePlayer.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
|
||||
playersToPing.add(onlinePlayer);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import net.kyori.adventure.text.format.TextColor;
|
|||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
|
@ -49,8 +50,8 @@ public class PlayerListener implements Listener {
|
|||
UUID uuid = player.getUniqueId();
|
||||
Toggleable.disableToggles(uuid);
|
||||
|
||||
if (serverConfig.FIRST_JOIN_MESSAGES && System.currentTimeMillis() - player.getFirstPlayed() < TimeUnit.SECONDS.toMillis(10)) {
|
||||
player.getServer().sendMessage(MiniMessage.miniMessage().deserialize(Config.FIRST_JOIN, Placeholder.parsed("player", player.getName())));
|
||||
if (serverConfig.FIRST_JOIN_MESSAGES && (!player.hasPlayedBefore() || System.currentTimeMillis() - player.getFirstPlayed() < TimeUnit.SECONDS.toMillis(10))) {
|
||||
Bukkit.broadcast(MiniMessage.miniMessage().deserialize(Config.FIRST_JOIN, Placeholder.parsed("player", player.getName())));
|
||||
}
|
||||
|
||||
ChatUser user = ChatUserManager.getChatUser(uuid);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.alttd.chat.nicknames;
|
||||
|
||||
import com.Zrips.CMI.CMI;
|
||||
import com.Zrips.CMI.Containers.CMIUser;
|
||||
import com.alttd.chat.ChatAPI;
|
||||
import com.alttd.chat.ChatPlugin;
|
||||
import com.alttd.chat.config.Config;
|
||||
|
|
@ -13,7 +11,6 @@ import com.alttd.chat.objects.Nick;
|
|||
import com.alttd.chat.util.Utility;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
|
|
@ -384,7 +381,7 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
|||
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
||||
user.setDisplayName(player.getName());
|
||||
player.displayName(user.getDisplayName());
|
||||
updateCMIUser(player, null);
|
||||
// updateCMIUser(player, null);
|
||||
}
|
||||
|
||||
public String getNick(final Player player) {
|
||||
|
|
@ -399,25 +396,25 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
|||
ChatUser user = ChatUserManager.getChatUser(player.getUniqueId());
|
||||
user.setDisplayName(nickName);
|
||||
player.displayName(user.getDisplayName());
|
||||
updateCMIUser(player, nickName);
|
||||
// updateCMIUser(player, nickName);
|
||||
}
|
||||
|
||||
// public static String format(final String m) {
|
||||
// return NickUtilities.applyColor(m);
|
||||
// }
|
||||
|
||||
public void updateCMIUser(Player player, String nickName) {
|
||||
if (!isCMIEnabled())
|
||||
return;
|
||||
|
||||
CMIUser cmiUser = CMI.getInstance().getPlayerManager().getUser(player);
|
||||
if (nickName == null){
|
||||
cmiUser.setNickName(null, true);
|
||||
} else {
|
||||
cmiUser.setNickName(NickUtilities.applyColor(nickName), true);
|
||||
}
|
||||
cmiUser.updateDisplayName();
|
||||
}
|
||||
// public void updateCMIUser(Player player, String nickName) {
|
||||
// if (!isCMIEnabled())
|
||||
// return;
|
||||
//
|
||||
// CMIUser cmiUser = CMI.getInstance().getPlayerManager().getUser(player);
|
||||
// if (nickName == null){
|
||||
// cmiUser.setNickName(null, true);
|
||||
// } else {
|
||||
// cmiUser.setNickName(NickUtilities.applyColor(nickName), true);
|
||||
// }
|
||||
// cmiUser.updateDisplayName();
|
||||
// }
|
||||
|
||||
private Boolean isCMIEnabled = null;
|
||||
private Boolean isCMIEnabled() {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
package com.alttd.chat.nicknames;
|
||||
|
||||
import com.Zrips.CMI.commands.list.colorlimits;
|
||||
import com.Zrips.CMI.utils.Util;
|
||||
import com.alttd.chat.ChatPlugin;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.alttd.chat.database.Queries;
|
||||
import com.alttd.chat.managers.ChatUserManager;
|
||||
import com.alttd.chat.objects.ChatUser;
|
||||
import com.alttd.chat.objects.Nick;
|
||||
import com.alttd.chat.util.ALogger;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class ToggleableForCustomChannel extends Toggleable {
|
|||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ALogger.info(String.format("%s sent %s message: %s", player.getName(), customChannel.getChannelName(), message));
|
||||
ChatPlugin.getInstance().getChatHandler().chatChannel(player, customChannel, message);
|
||||
}
|
||||
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
||||
|
|
|
|||
BIN
libs/CMI.jar
BIN
libs/CMI.jar
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("io.github.goooler.shadow")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user