mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +00:00
Merge addons into main plugin
This commit is contained in:
1 parent
02732d5b5d
commit
ad9a794156
28 files changed
+258
-516
No files matched your search
@@ -6,6 +6,8 @@ plugins {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven { url = "https://maven.enginehub.org/repo/" }
|
||||||
|
maven { url = "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -20,6 +22,9 @@ dependencies {
|
|||||||
compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT'
|
compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT'
|
||||||
compile 'io.lettuce:lettuce-core:6.0.0.M1'
|
compile 'io.lettuce:lettuce-core:6.0.0.M1'
|
||||||
|
|
||||||
|
compileOnly 'com.gmail.nossr50.mcMMO:mcMMO:2.1.143'
|
||||||
|
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
|
||||||
|
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT'
|
||||||
compileOnly 'me.clip:placeholderapi:2.10.9'
|
compileOnly 'me.clip:placeholderapi:2.10.9'
|
||||||
compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11'
|
compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11'
|
||||||
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
|
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
|
||||||
@@ -37,7 +42,7 @@ bukkit {
|
|||||||
apiVersion = '1.13'
|
apiVersion = '1.13'
|
||||||
author = 'Draycia'
|
author = 'Draycia'
|
||||||
depend = ['PlaceholderAPI', 'Vault']
|
depend = ['PlaceholderAPI', 'Vault']
|
||||||
softDepend = ['LuckPerms']
|
softDepend = ['LuckPerms', 'Towny', 'mcMMO', 'WorldGuard']
|
||||||
loadBefore = ["Essentials"]
|
loadBefore = ["Essentials"]
|
||||||
permissions {
|
permissions {
|
||||||
'carbonchat.channels.Global.see' {
|
'carbonchat.channels.Global.see' {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package net.draycia.carbon;
|
package net.draycia.carbon;
|
||||||
|
|
||||||
import net.draycia.carbon.channels.contexts.impl.DistanceContext;
|
import net.draycia.carbon.channels.contexts.impl.DistanceContext;
|
||||||
|
import net.draycia.carbon.channels.contexts.impl.TownyContext;
|
||||||
|
import net.draycia.carbon.channels.contexts.impl.WorldGuardContext;
|
||||||
|
import net.draycia.carbon.channels.contexts.impl.mcMMOContext;
|
||||||
import net.draycia.carbon.listeners.*;
|
import net.draycia.carbon.listeners.*;
|
||||||
import net.draycia.carbon.managers.*;
|
import net.draycia.carbon.managers.*;
|
||||||
import net.draycia.carbon.messaging.MessageManager;
|
import net.draycia.carbon.messaging.MessageManager;
|
||||||
@@ -11,9 +14,15 @@ import net.draycia.carbon.util.CarbonPlaceholders;
|
|||||||
import net.draycia.carbon.util.ItemStackUtils;
|
import net.draycia.carbon.util.ItemStackUtils;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class CarbonChat extends JavaPlugin {
|
public final class CarbonChat extends JavaPlugin {
|
||||||
|
|
||||||
private Permission permission;
|
private Permission permission;
|
||||||
@@ -28,11 +37,25 @@ public final class CarbonChat extends JavaPlugin {
|
|||||||
|
|
||||||
private ItemStackUtils itemStackUtils;
|
private ItemStackUtils itemStackUtils;
|
||||||
|
|
||||||
|
private YamlConfiguration modConfig;
|
||||||
|
|
||||||
public static final LegacyComponentSerializer LEGACY =
|
public static final LegacyComponentSerializer LEGACY =
|
||||||
LegacyComponentSerializer.builder().extractUrls().character('§').build();
|
LegacyComponentSerializer.builder().extractUrls().character('§').build();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
// Ensure config is present to be modified by the user
|
||||||
|
saveDefaultConfig();
|
||||||
|
saveResource("moderation.yml", false);
|
||||||
|
|
||||||
|
modConfig = new YamlConfiguration();
|
||||||
|
|
||||||
|
try {
|
||||||
|
modConfig.load(new File(getDataFolder(), "moderation.yml"));
|
||||||
|
} catch (IOException | InvalidConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
// Setup Adventure
|
// Setup Adventure
|
||||||
adventureManager = new AdventureManager(this);
|
adventureManager = new AdventureManager(this);
|
||||||
|
|
||||||
@@ -45,9 +68,6 @@ public final class CarbonChat extends JavaPlugin {
|
|||||||
// Setup vault and permissions
|
// Setup vault and permissions
|
||||||
permission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
|
permission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
|
||||||
|
|
||||||
// Ensure config is present to be modified by the user
|
|
||||||
saveDefaultConfig();
|
|
||||||
|
|
||||||
// Initialize managers
|
// Initialize managers
|
||||||
commandManager = new CommandManager(this);
|
commandManager = new CommandManager(this);
|
||||||
channelManager = new ChannelManager(this);
|
channelManager = new ChannelManager(this);
|
||||||
@@ -72,6 +92,18 @@ public final class CarbonChat extends JavaPlugin {
|
|||||||
registerContexts();
|
registerContexts();
|
||||||
|
|
||||||
new CarbonPlaceholders(this).register();
|
new CarbonPlaceholders(this).register();
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("Towny")) {
|
||||||
|
getServer().getPluginManager().registerEvents(new TownyContext(this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("mcMMO")) {
|
||||||
|
getServer().getPluginManager().registerEvents(new mcMMOContext(this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) {
|
||||||
|
getServer().getPluginManager().registerEvents(new WorldGuardContext(this), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -95,12 +127,21 @@ public final class CarbonChat extends JavaPlugin {
|
|||||||
pluginManager.registerEvents(new UserFormattingListener(), this);
|
pluginManager.registerEvents(new UserFormattingListener(), this);
|
||||||
pluginManager.registerEvents(new WhisperPingHandler(this), this);
|
pluginManager.registerEvents(new WhisperPingHandler(this), this);
|
||||||
pluginManager.registerEvents(new RequiredBalanceHandler(this), this);
|
pluginManager.registerEvents(new RequiredBalanceHandler(this), this);
|
||||||
|
|
||||||
|
pluginManager.registerEvents(new CapsHandler(this), this);
|
||||||
|
pluginManager.registerEvents(new FilterHandler(this), this);
|
||||||
|
pluginManager.registerEvents(new MuteHandler(), this);
|
||||||
|
pluginManager.registerEvents(new ShadowMuteHandler(this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerContexts() {
|
private void registerContexts() {
|
||||||
getContextManager().register("distance", new DistanceContext());
|
getContextManager().register("distance", new DistanceContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YamlConfiguration getModConfig() {
|
||||||
|
return modConfig;
|
||||||
|
}
|
||||||
|
|
||||||
public Permission getPermission() {
|
public Permission getPermission() {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-14
@@ -1,4 +1,4 @@
|
|||||||
package net.draycia.carbontowny;
|
package net.draycia.carbon.channels.contexts.impl;
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.TownyAPI;
|
import com.palmergames.bukkit.towny.TownyAPI;
|
||||||
import com.palmergames.bukkit.towny.event.TownRemoveResidentEvent;
|
import com.palmergames.bukkit.towny.event.TownRemoveResidentEvent;
|
||||||
@@ -8,32 +8,25 @@ import net.draycia.carbon.CarbonChat;
|
|||||||
import net.draycia.carbon.events.ChannelSwitchEvent;
|
import net.draycia.carbon.events.ChannelSwitchEvent;
|
||||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||||
import net.draycia.carbon.storage.ChatUser;
|
import net.draycia.carbon.storage.ChatUser;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public final class CarbonChatTowny extends JavaPlugin implements Listener {
|
public final class TownyContext implements Listener {
|
||||||
|
|
||||||
private CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
private static final String KEY = "towny-town";
|
private static final String KEY = "towny-town";
|
||||||
|
|
||||||
@Override
|
public TownyContext(CarbonChat carbonChat) {
|
||||||
public void onEnable() {
|
this.carbonChat = carbonChat;
|
||||||
saveDefaultConfig();
|
|
||||||
|
|
||||||
carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
this.carbonChat.getContextManager().register("towny-town", (context) -> {
|
||||||
|
|
||||||
carbonChat.getContextManager().register("towny-town", (context) -> {
|
|
||||||
if ((context.getValue() instanceof Boolean) && ((Boolean) context.getValue())) {
|
if ((context.getValue() instanceof Boolean) && ((Boolean) context.getValue())) {
|
||||||
return isInSameTown(context.getSender(), context.getTarget());
|
return isInSameTown(context.getSender(), context.getTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
@@ -43,7 +36,7 @@ public final class CarbonChatTowny extends JavaPlugin implements Listener {
|
|||||||
if ((town instanceof Boolean) && ((Boolean) town)) {
|
if ((town instanceof Boolean) && ((Boolean) town)) {
|
||||||
if (!isInTown(event.getUser())) {
|
if (!isInTown(event.getUser())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setFailureMessage(getConfig().getString("cancellation-message"));
|
event.setFailureMessage(carbonChat.getConfig().getString("contexts.Towny.cancellation-message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-11
@@ -1,4 +1,4 @@
|
|||||||
package net.draycia.carbonworldguard;
|
package net.draycia.carbon.channels.contexts.impl;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@@ -12,27 +12,19 @@ import net.draycia.carbon.CarbonChat;
|
|||||||
import net.draycia.carbon.events.ChannelSwitchEvent;
|
import net.draycia.carbon.events.ChannelSwitchEvent;
|
||||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||||
import net.draycia.carbon.storage.ChatUser;
|
import net.draycia.carbon.storage.ChatUser;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class CarbonChatWorldGuard extends JavaPlugin implements Listener {
|
public final class WorldGuardContext implements Listener {
|
||||||
|
|
||||||
private static final String KEY = "worldguard-region";
|
private static final String KEY = "worldguard-region";
|
||||||
|
|
||||||
@Override
|
public WorldGuardContext(CarbonChat carbonChat) {
|
||||||
public void onEnable() {
|
|
||||||
saveDefaultConfig();
|
|
||||||
CarbonChat carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
|
||||||
|
|
||||||
carbonChat.getContextManager().register(KEY, (context) -> {
|
carbonChat.getContextManager().register(KEY, (context) -> {
|
||||||
return this.testContext(context.getSender(), context.getTarget(), context.getValue());
|
return this.testContext(context.getSender(), context.getTarget(), context.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
+6
-12
@@ -1,4 +1,4 @@
|
|||||||
package net.draycia.carbonmcmmo;
|
package net.draycia.carbon.channels.contexts.impl;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.PartyAPI;
|
import com.gmail.nossr50.api.PartyAPI;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||||
@@ -6,31 +6,24 @@ import net.draycia.carbon.CarbonChat;
|
|||||||
import net.draycia.carbon.events.ChannelSwitchEvent;
|
import net.draycia.carbon.events.ChannelSwitchEvent;
|
||||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||||
import net.draycia.carbon.storage.ChatUser;
|
import net.draycia.carbon.storage.ChatUser;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public final class CarbonChatMCMMO extends JavaPlugin implements Listener {
|
public final class mcMMOContext implements Listener {
|
||||||
|
|
||||||
private CarbonChat carbonChat;
|
private CarbonChat carbonChat;
|
||||||
|
|
||||||
@Override
|
public mcMMOContext(CarbonChat carbonChat) {
|
||||||
public void onEnable() {
|
this.carbonChat = carbonChat;
|
||||||
saveDefaultConfig();
|
|
||||||
|
|
||||||
carbonChat = (CarbonChat) Bukkit.getPluginManager().getPlugin("CarbonChat");
|
this.carbonChat.getContextManager().register("mcmmo-party", (context) -> {
|
||||||
|
|
||||||
carbonChat.getContextManager().register("mcmmo-party", (context) -> {
|
|
||||||
if ((context.getValue() instanceof Boolean) && ((Boolean) context.getValue())) {
|
if ((context.getValue() instanceof Boolean) && ((Boolean) context.getValue())) {
|
||||||
return isInSameParty(context.getSender(), context.getTarget());
|
return isInSameParty(context.getSender(), context.getTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
@@ -40,6 +33,7 @@ public final class CarbonChatMCMMO extends JavaPlugin implements Listener {
|
|||||||
if ((party instanceof Boolean) && ((Boolean) party)) {
|
if ((party instanceof Boolean) && ((Boolean) party)) {
|
||||||
if (!isInParty(event.getUser())) {
|
if (!isInParty(event.getUser())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
event.setFailureMessage(carbonChat.getConfig().getString("contexts.mcMMO.cancellation-message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package net.draycia.carbon.commands;
|
||||||
|
|
||||||
|
import co.aikar.commands.BaseCommand;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import co.aikar.commands.annotation.Dependency;
|
||||||
|
import net.draycia.carbon.CarbonChat;
|
||||||
|
import net.draycia.carbon.storage.ChatUser;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandAlias("clearchat|cc")
|
||||||
|
@CommandPermission("carbonchat.clearchat.clear")
|
||||||
|
public class ClearChatCommand extends BaseCommand {
|
||||||
|
|
||||||
|
@Dependency
|
||||||
|
private CarbonChat carbonChat;
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void baseCommand(CommandSender issuer) {
|
||||||
|
String format = carbonChat.getModConfig().getString("clear-chat.message", "");
|
||||||
|
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n");
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (player.hasPermission("carbonchat.clearchat.exempt")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatUser audience = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
|
for (int i = 0; i < carbonChat.getModConfig().getInt("clear-chat.message-count", 100); i++) {
|
||||||
|
audience.sendMessage(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.hasPermission("carbonchat.clearchat.notify")) {
|
||||||
|
String message = carbonChat.getModConfig().getString("language.clear-notify");
|
||||||
|
audience.sendMessage(carbonChat.getAdventureManager().processMessage(message, "player", issuer.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.hasPermission("carbonchat.clearchat.exempt")) {
|
||||||
|
String message = carbonChat.getModConfig().getString("language.clear-exempt");
|
||||||
|
audience.sendMessage(carbonChat.getAdventureManager().processMessage(message, "player", issuer.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package net.draycia.carbon.commands;
|
||||||
|
|
||||||
|
import co.aikar.commands.annotation.*;
|
||||||
|
import co.aikar.commands.BaseCommand;
|
||||||
|
import net.draycia.carbon.CarbonChat;
|
||||||
|
import net.draycia.carbon.storage.ChatUser;
|
||||||
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@CommandAlias("mute")
|
||||||
|
@CommandPermission("carbonchat.mute")
|
||||||
|
public class MuteCommand extends BaseCommand {
|
||||||
|
|
||||||
|
@Dependency
|
||||||
|
private CarbonChat carbonChat;
|
||||||
|
|
||||||
|
@Default
|
||||||
|
@CommandCompletion("@players")
|
||||||
|
@Syntax("<player>")
|
||||||
|
public void baseCommand(CommandSender sender, ChatUser targetUser) {
|
||||||
|
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
|
|
||||||
|
if (targetUser.isMuted()) {
|
||||||
|
targetUser.setMuted(false);
|
||||||
|
String format = carbonChat.getModConfig().getString("language.no-longer-muted");
|
||||||
|
|
||||||
|
Component message = carbonChat.getAdventureManager().processMessage(format, "br", "\n",
|
||||||
|
"player", targetUser.asOfflinePlayer().getName());
|
||||||
|
|
||||||
|
audience.sendMessage(message);
|
||||||
|
} else {
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(carbonChat, () -> {
|
||||||
|
Permission permission = carbonChat.getPermission();
|
||||||
|
String format;
|
||||||
|
|
||||||
|
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "carbonchat.mute.exempt")) {
|
||||||
|
format = carbonChat.getModConfig().getString("language.mute-exempt");
|
||||||
|
} else {
|
||||||
|
targetUser.setMuted(true);
|
||||||
|
format = carbonChat.getModConfig().getString("language.is-now-muted");
|
||||||
|
}
|
||||||
|
|
||||||
|
Component message = carbonChat.getAdventureManager().processMessage(format, "br", "\n",
|
||||||
|
"player", targetUser.asOfflinePlayer().getName());
|
||||||
|
|
||||||
|
audience.sendMessage(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package net.draycia.carbon.commands;
|
||||||
|
|
||||||
|
import co.aikar.commands.annotation.*;
|
||||||
|
import co.aikar.commands.BaseCommand;
|
||||||
|
import net.draycia.carbon.CarbonChat;
|
||||||
|
import net.draycia.carbon.storage.ChatUser;
|
||||||
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@CommandAlias("shadowmute|sm|smute")
|
||||||
|
@CommandPermission("carbonchat.shadowmute")
|
||||||
|
public class ShadowMuteCommand extends BaseCommand {
|
||||||
|
|
||||||
|
@Dependency
|
||||||
|
private CarbonChat carbonChat;
|
||||||
|
|
||||||
|
@Default
|
||||||
|
@CommandCompletion("@players")
|
||||||
|
@Syntax("<player>")
|
||||||
|
public void baseCommand(CommandSender sender, ChatUser targetUser) {
|
||||||
|
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
|
|
||||||
|
if (targetUser.isShadowMuted()) {
|
||||||
|
targetUser.setShadowMuted(false);
|
||||||
|
String format = carbonChat.getModConfig().getString("language.no-longer-shadow-muted");
|
||||||
|
|
||||||
|
Component message = carbonChat.getAdventureManager().processMessage(format, "br", "\n",
|
||||||
|
"player", targetUser.asOfflinePlayer().getName());
|
||||||
|
|
||||||
|
audience.sendMessage(message);
|
||||||
|
} else {
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(carbonChat, () -> {
|
||||||
|
Permission permission = carbonChat.getPermission();
|
||||||
|
String format;
|
||||||
|
|
||||||
|
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "carbonchat.shadowmute.exempt")) {
|
||||||
|
format = carbonChat.getModConfig().getString("language.shadow-mute-exempt");
|
||||||
|
} else {
|
||||||
|
targetUser.setShadowMuted(true);
|
||||||
|
format = carbonChat.getModConfig().getString("language.is-now-shadow-muted");
|
||||||
|
}
|
||||||
|
|
||||||
|
Component message = carbonChat.getAdventureManager().processMessage(format, "br", "\n",
|
||||||
|
"player", targetUser.asOfflinePlayer().getName());
|
||||||
|
|
||||||
|
audience.sendMessage(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
-9
@@ -1,26 +1,26 @@
|
|||||||
package net.draycia.carbonmoderation.listeners;
|
package net.draycia.carbon.listeners;
|
||||||
|
|
||||||
|
import net.draycia.carbon.CarbonChat;
|
||||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public class CapsHandler implements Listener {
|
public class CapsHandler implements Listener {
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public CapsHandler(CarbonChatModeration moderation) {
|
public CapsHandler(CarbonChat carbonChat) {
|
||||||
this.moderation = moderation;
|
this.carbonChat = carbonChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onMessage(PreChatFormatEvent event) {
|
public void onMessage(PreChatFormatEvent event) {
|
||||||
if (!moderation.getConfig().getBoolean("caps-protection.enabled")) {
|
if (!carbonChat.getModConfig().getBoolean("caps-protection.enabled")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(event.getMessage().length() >= moderation.getConfig().getInt("caps-protection.minimum-length"))) {
|
if (!(event.getMessage().length() >= carbonChat.getModConfig().getInt("caps-protection.minimum-length"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@ public class CapsHandler implements Listener {
|
|||||||
|
|
||||||
double capsPercentage = (amountOfCaps * 100.0) / event.getMessage().length();
|
double capsPercentage = (amountOfCaps * 100.0) / event.getMessage().length();
|
||||||
|
|
||||||
if (!(capsPercentage >= moderation.getConfig().getDouble("caps-protection.percent-caps"))) {
|
if (!(capsPercentage >= carbonChat.getModConfig().getDouble("caps-protection.percent-caps"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moderation.getConfig().getBoolean("block-message")) {
|
if (carbonChat.getModConfig().getBoolean("block-message")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
event.setMessage(event.getMessage().toLowerCase());
|
event.setMessage(event.getMessage().toLowerCase());
|
||||||
+9
-9
@@ -1,8 +1,8 @@
|
|||||||
package net.draycia.carbonmoderation.listeners;
|
package net.draycia.carbon.listeners;
|
||||||
|
|
||||||
|
import net.draycia.carbon.CarbonChat;
|
||||||
import net.draycia.carbon.channels.ChatChannel;
|
import net.draycia.carbon.channels.ChatChannel;
|
||||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -18,15 +18,15 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class FilterHandler implements Listener {
|
public class FilterHandler implements Listener {
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
private final Map<String, List<Pattern>> patternReplacements = new HashMap<>();
|
private final Map<String, List<Pattern>> patternReplacements = new HashMap<>();
|
||||||
private final List<Pattern> blockedWords = new ArrayList<>();
|
private final List<Pattern> blockedWords = new ArrayList<>();
|
||||||
|
|
||||||
public FilterHandler(CarbonChatModeration moderation) {
|
public FilterHandler(CarbonChat carbonChat) {
|
||||||
this.moderation = moderation;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
FileConfiguration config = moderation.getConfig();
|
FileConfiguration config = carbonChat.getModConfig();
|
||||||
|
|
||||||
ConfigurationSection filters = config.getConfigurationSection("filters.filters");
|
ConfigurationSection filters = config.getConfigurationSection("filters.filters");
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public class FilterHandler implements Listener {
|
|||||||
List<Pattern> patterns = new ArrayList<>();
|
List<Pattern> patterns = new ArrayList<>();
|
||||||
|
|
||||||
for (String word : filters.getStringList(replacement)) {
|
for (String word : filters.getStringList(replacement)) {
|
||||||
if (moderation.getConfig().getBoolean("filters.case-sensitive")) {
|
if (carbonChat.getModConfig().getBoolean("filters.case-sensitive")) {
|
||||||
patterns.add(Pattern.compile(word));
|
patterns.add(Pattern.compile(word));
|
||||||
} else {
|
} else {
|
||||||
patterns.add(Pattern.compile(word, Pattern.CASE_INSENSITIVE));
|
patterns.add(Pattern.compile(word, Pattern.CASE_INSENSITIVE));
|
||||||
@@ -46,7 +46,7 @@ public class FilterHandler implements Listener {
|
|||||||
|
|
||||||
for (String replacement : config.getStringList("filters.blocked-words")) {
|
for (String replacement : config.getStringList("filters.blocked-words")) {
|
||||||
for (String word : filters.getStringList(replacement)) {
|
for (String word : filters.getStringList(replacement)) {
|
||||||
if (moderation.getConfig().getBoolean("filters.case-sensitive")) {
|
if (carbonChat.getModConfig().getBoolean("filters.case-sensitive")) {
|
||||||
blockedWords.add(Pattern.compile(word));
|
blockedWords.add(Pattern.compile(word));
|
||||||
} else {
|
} else {
|
||||||
blockedWords.add(Pattern.compile(word, Pattern.CASE_INSENSITIVE));
|
blockedWords.add(Pattern.compile(word, Pattern.CASE_INSENSITIVE));
|
||||||
@@ -57,7 +57,7 @@ public class FilterHandler implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onFilter(PreChatFormatEvent event) {
|
public void onFilter(PreChatFormatEvent event) {
|
||||||
if (!moderation.getConfig().getBoolean("filters.enabled")) {
|
if (!carbonChat.getModConfig().getBoolean("filters.enabled")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package net.draycia.carbonmoderation.listeners;
|
package net.draycia.carbon.listeners;
|
||||||
|
|
||||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
+6
-6
@@ -1,18 +1,18 @@
|
|||||||
package net.draycia.carbonmoderation.listeners;
|
package net.draycia.carbon.listeners;
|
||||||
|
|
||||||
|
import net.draycia.carbon.CarbonChat;
|
||||||
import net.draycia.carbon.events.ChatComponentEvent;
|
import net.draycia.carbon.events.ChatComponentEvent;
|
||||||
import net.draycia.carbon.events.ChatFormatEvent;
|
import net.draycia.carbon.events.ChatFormatEvent;
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public class ShadowMuteHandler implements Listener {
|
public class ShadowMuteHandler implements Listener {
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ShadowMuteHandler(CarbonChatModeration moderation) {
|
public ShadowMuteHandler(CarbonChat carbonChat) {
|
||||||
this.moderation = moderation;
|
this.carbonChat = carbonChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
@@ -34,7 +34,7 @@ public class ShadowMuteHandler implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String prefix = moderation.getConfig().getString("shadow-mute-prefix", "[SM] ");
|
String prefix = carbonChat.getModConfig().getString("shadow-mute-prefix", "[SM] ");
|
||||||
|
|
||||||
event.setFormat(prefix + event.getFormat());
|
event.setFormat(prefix + event.getFormat());
|
||||||
}
|
}
|
||||||
@@ -91,6 +91,10 @@ public class CommandManager {
|
|||||||
this.commandManager.registerCommand(new ReplyCommand());
|
this.commandManager.registerCommand(new ReplyCommand());
|
||||||
this.commandManager.registerCommand(new SetColorCommand());
|
this.commandManager.registerCommand(new SetColorCommand());
|
||||||
this.commandManager.registerCommand(new SpyChannelCommand());
|
this.commandManager.registerCommand(new SpyChannelCommand());
|
||||||
|
|
||||||
|
this.commandManager.registerCommand(new ClearChatCommand());
|
||||||
|
this.commandManager.registerCommand(new MuteCommand());
|
||||||
|
this.commandManager.registerCommand(new ShadowMuteCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitCommandManager getCommandManager() {
|
public BukkitCommandManager getCommandManager() {
|
||||||
|
|||||||
@@ -127,6 +127,12 @@ language:
|
|||||||
nickname-set: '<green>Your nickname was set to <nickname><reset><green>!'
|
nickname-set: '<green>Your nickname was set to <nickname><reset><green>!'
|
||||||
nickname-reset: '<green>Your nickname was reset!'
|
nickname-reset: '<green>Your nickname was reset!'
|
||||||
|
|
||||||
|
contexts:
|
||||||
|
Towny:
|
||||||
|
cancellation-message: '<red>You do not belong to a town!'
|
||||||
|
mcMMO:
|
||||||
|
cancellation-message: '<red>You do not have a party!'
|
||||||
|
|
||||||
# Used for <server> placeholder in channel formats
|
# Used for <server> placeholder in channel formats
|
||||||
server-name: 'Server'
|
server-name: 'Server'
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url 'https://jitpack.io' }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'com.github.mcMMO-Dev:mcMMO:-SNAPSHOT'
|
|
||||||
|
|
||||||
compileOnly project(path: ':CarbonChat', configuration: 'shadow')
|
|
||||||
}
|
|
||||||
|
|
||||||
description = 'CarbonChatMCMMO'
|
|
||||||
|
|
||||||
bukkit {
|
|
||||||
name = description
|
|
||||||
version = project.version
|
|
||||||
main = 'net.draycia.carbonmcmmo.CarbonChatMCMMO'
|
|
||||||
apiVersion = '1.13'
|
|
||||||
author = 'Draycia'
|
|
||||||
depend = ['CarbonChat', 'mcMMO']
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.build.dependsOn tasks.shadowJar
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
cancellation-message: "<red>You do not have a party!"
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly project(path: ':CarbonChat', configuration: 'shadow')
|
|
||||||
}
|
|
||||||
|
|
||||||
description = 'CarbonChatModeration'
|
|
||||||
|
|
||||||
bukkit {
|
|
||||||
name = description
|
|
||||||
version = project.version
|
|
||||||
main = 'net.draycia.carbonmoderation.CarbonChatModeration'
|
|
||||||
apiVersion = '1.13'
|
|
||||||
author = 'Draycia'
|
|
||||||
depend = ['CarbonChat']
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.build.dependsOn tasks.shadowJar
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
relocate "co.aikar.commands", "net.draycia.carbon.libs.co.aikar.commands"
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
-54
@@ -1,54 +0,0 @@
|
|||||||
package net.draycia.carbonmoderation;
|
|
||||||
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.BukkitCommandManager;
|
|
||||||
import net.draycia.carbon.CarbonChat;
|
|
||||||
import net.draycia.carbonmoderation.commands.ClearChatCommand;
|
|
||||||
import net.draycia.carbonmoderation.commands.ModReloadCommand;
|
|
||||||
import net.draycia.carbonmoderation.commands.MuteCommand;
|
|
||||||
import net.draycia.carbonmoderation.commands.ShadowMuteCommand;
|
|
||||||
import net.draycia.carbonmoderation.listeners.CapsHandler;
|
|
||||||
import net.draycia.carbonmoderation.listeners.FilterHandler;
|
|
||||||
import net.draycia.carbonmoderation.listeners.MuteHandler;
|
|
||||||
import net.draycia.carbonmoderation.listeners.ShadowMuteHandler;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public final class CarbonChatModeration extends JavaPlugin {
|
|
||||||
|
|
||||||
private CarbonChat carbonChat;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
saveDefaultConfig();
|
|
||||||
|
|
||||||
carbonChat = (CarbonChat)Bukkit.getPluginManager().getPlugin("CarbonChat");
|
|
||||||
|
|
||||||
registerCommands();
|
|
||||||
registerListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerCommands() {
|
|
||||||
BukkitCommandManager commandManager = carbonChat.getCommandManager().getCommandManager();
|
|
||||||
|
|
||||||
commandManager.registerCommand(new ClearChatCommand(this));
|
|
||||||
commandManager.registerCommand(new MuteCommand(this));
|
|
||||||
commandManager.registerCommand(new ShadowMuteCommand(this));
|
|
||||||
commandManager.registerCommand(new ModReloadCommand(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerListeners() {
|
|
||||||
Bukkit.getPluginManager().registerEvents(new CapsHandler(this), this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(new FilterHandler(this), this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(new MuteHandler(), this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(new ShadowMuteHandler(this), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public CarbonChat getCarbonChat() {
|
|
||||||
return carbonChat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
package net.draycia.carbonmoderation.commands;
|
|
||||||
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.BaseCommand;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandAlias;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandPermission;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Default;
|
|
||||||
import net.draycia.carbon.storage.ChatUser;
|
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import net.draycia.carbon.libs.net.kyori.adventure.text.Component;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandAlias("clearchat|cc")
|
|
||||||
@CommandPermission("carbonchat.clearchat.clear")
|
|
||||||
public class ClearChatCommand extends BaseCommand {
|
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
|
||||||
|
|
||||||
public ClearChatCommand(CarbonChatModeration moderation) {
|
|
||||||
this.moderation = moderation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Default
|
|
||||||
public void baseCommand(CommandSender issuer) {
|
|
||||||
String format = moderation.getConfig().getString("clear-chat.message", "");
|
|
||||||
Component component = moderation.getCarbonChat().getAdventureManager().processMessage(format, "br", "\n");
|
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (player.hasPermission("carbonchat.clearchat.exempt")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatUser audience = moderation.getCarbonChat().getUserService().wrap(player);
|
|
||||||
|
|
||||||
for (int i = 0; i < moderation.getConfig().getInt("clear-chat.message-count", 100); i++) {
|
|
||||||
audience.sendMessage(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.hasPermission("carbonchat.clearchat.notify")) {
|
|
||||||
String message = moderation.getConfig().getString("language.clear-notify");
|
|
||||||
audience.sendMessage(moderation.getCarbonChat().getAdventureManager().processMessage(message, "player", issuer.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.hasPermission("carbonchat.clearchat.exempt")) {
|
|
||||||
String message = moderation.getConfig().getString("language.clear-exempt");
|
|
||||||
audience.sendMessage(moderation.getCarbonChat().getAdventureManager().processMessage(message, "player", issuer.getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
package net.draycia.carbonmoderation.commands;
|
|
||||||
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.BaseCommand;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandAlias;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandPermission;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Default;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Dependency;
|
|
||||||
import net.draycia.carbon.libs.net.kyori.adventure.text.Component;
|
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
@CommandAlias("modreload|mreload")
|
|
||||||
@CommandPermission("carbonchat.reload")
|
|
||||||
public class ModReloadCommand extends BaseCommand {
|
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
|
||||||
|
|
||||||
public ModReloadCommand(CarbonChatModeration moderation) {
|
|
||||||
this.moderation = moderation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Default
|
|
||||||
public void baseCommand(CommandSender sender) {
|
|
||||||
moderation.reloadConfig();
|
|
||||||
|
|
||||||
Component message = moderation.getCarbonChat().getAdventureManager()
|
|
||||||
.processMessage(moderation.getConfig().getString("language.reloaded"),
|
|
||||||
"br", "\n");
|
|
||||||
|
|
||||||
moderation.getCarbonChat().getAdventureManager().getAudiences().audience(sender).sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
package net.draycia.carbonmoderation.commands;
|
|
||||||
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Syntax;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.BaseCommand;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandAlias;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandCompletion;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandPermission;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Default;
|
|
||||||
import net.draycia.carbon.storage.ChatUser;
|
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import net.draycia.carbon.libs.net.kyori.adventure.audience.Audience;
|
|
||||||
import net.draycia.carbon.libs.net.kyori.adventure.text.Component;
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
@CommandAlias("mute")
|
|
||||||
@CommandPermission("carbonchat.mute")
|
|
||||||
public class MuteCommand extends BaseCommand {
|
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
|
||||||
|
|
||||||
public MuteCommand(CarbonChatModeration moderation) {
|
|
||||||
this.moderation = moderation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Default
|
|
||||||
@CommandCompletion("@players")
|
|
||||||
@Syntax("<player>")
|
|
||||||
public void baseCommand(CommandSender sender, ChatUser targetUser) {
|
|
||||||
Audience audience = moderation.getCarbonChat().getAdventureManager().getAudiences().audience(sender);
|
|
||||||
|
|
||||||
if (targetUser.isMuted()) {
|
|
||||||
targetUser.setMuted(false);
|
|
||||||
String format = moderation.getConfig().getString("language.no-longer-muted");
|
|
||||||
|
|
||||||
Component message = moderation.getCarbonChat().getAdventureManager().processMessage(format, "br", "\n",
|
|
||||||
"player", targetUser.asOfflinePlayer().getName());
|
|
||||||
|
|
||||||
audience.sendMessage(message);
|
|
||||||
} else {
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(moderation, () -> {
|
|
||||||
Permission permission = moderation.getCarbonChat().getPermission();
|
|
||||||
String format;
|
|
||||||
|
|
||||||
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "carbonchat.mute.exempt")) {
|
|
||||||
format = moderation.getConfig().getString("language.mute-exempt");
|
|
||||||
} else {
|
|
||||||
targetUser.setMuted(true);
|
|
||||||
format = moderation.getConfig().getString("language.is-now-muted");
|
|
||||||
}
|
|
||||||
|
|
||||||
Component message = moderation.getCarbonChat().getAdventureManager().processMessage(format, "br", "\n",
|
|
||||||
"player", targetUser.asOfflinePlayer().getName());
|
|
||||||
|
|
||||||
audience.sendMessage(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-60
@@ -1,60 +0,0 @@
|
|||||||
package net.draycia.carbonmoderation.commands;
|
|
||||||
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Syntax;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.BaseCommand;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandAlias;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandCompletion;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.CommandPermission;
|
|
||||||
import net.draycia.carbon.libs.co.aikar.commands.annotation.Default;
|
|
||||||
import net.draycia.carbon.storage.ChatUser;
|
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
|
||||||
import net.draycia.carbon.libs.net.kyori.adventure.audience.Audience;
|
|
||||||
import net.draycia.carbon.libs.net.kyori.adventure.text.Component;
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
@CommandAlias("shadowmute|sm|smute")
|
|
||||||
@CommandPermission("carbonchat.shadowmute")
|
|
||||||
public class ShadowMuteCommand extends BaseCommand {
|
|
||||||
|
|
||||||
private final CarbonChatModeration moderation;
|
|
||||||
|
|
||||||
public ShadowMuteCommand(CarbonChatModeration moderation) {
|
|
||||||
this.moderation = moderation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Default
|
|
||||||
@CommandCompletion("@players")
|
|
||||||
@Syntax("<player>")
|
|
||||||
public void baseCommand(CommandSender sender, ChatUser targetUser) {
|
|
||||||
Audience audience = moderation.getCarbonChat().getAdventureManager().getAudiences().audience(sender);
|
|
||||||
|
|
||||||
if (targetUser.isShadowMuted()) {
|
|
||||||
targetUser.setShadowMuted(false);
|
|
||||||
String format = moderation.getConfig().getString("language.no-longer-shadow-muted");
|
|
||||||
|
|
||||||
Component message = moderation.getCarbonChat().getAdventureManager().processMessage(format, "br", "\n",
|
|
||||||
"player", targetUser.asOfflinePlayer().getName());
|
|
||||||
|
|
||||||
audience.sendMessage(message);
|
|
||||||
} else {
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(moderation, () -> {
|
|
||||||
Permission permission = moderation.getCarbonChat().getPermission();
|
|
||||||
String format;
|
|
||||||
|
|
||||||
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "carbonchat.shadowmute.exempt")) {
|
|
||||||
format = moderation.getConfig().getString("language.shadow-mute-exempt");
|
|
||||||
} else {
|
|
||||||
targetUser.setShadowMuted(true);
|
|
||||||
format = moderation.getConfig().getString("language.is-now-shadow-muted");
|
|
||||||
}
|
|
||||||
|
|
||||||
Component message = moderation.getCarbonChat().getAdventureManager().processMessage(format, "br", "\n",
|
|
||||||
"player", targetUser.asOfflinePlayer().getName());
|
|
||||||
|
|
||||||
audience.sendMessage(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
caps-protection:
|
|
||||||
enabled: true
|
|
||||||
minimum-length: 10
|
|
||||||
percent-caps: 80
|
|
||||||
block-message: false
|
|
||||||
|
|
||||||
shadow-mute-prefix: '[SM] '
|
|
||||||
|
|
||||||
filters:
|
|
||||||
enabled: true
|
|
||||||
case-sensitive: false
|
|
||||||
# The keys ("****" for example) are what the text is replaced with
|
|
||||||
# The strings in the lists ("lag" etc) are what's replaced
|
|
||||||
filters:
|
|
||||||
# In this example, any instance of "lag" or "laggggg" will be replaced with "****"
|
|
||||||
"****":
|
|
||||||
- "la[g]+"
|
|
||||||
- "lag"
|
|
||||||
# Underscore = blank, empty. The text will basically be removed.
|
|
||||||
"_":
|
|
||||||
- "broccoli sucks"
|
|
||||||
# Anything in blocked-words will prevent the message from being sent at all.
|
|
||||||
blocked-words:
|
|
||||||
- "pineapple doesn't belong on pizza"
|
|
||||||
|
|
||||||
clear-chat:
|
|
||||||
# The message sent to clear chat, you probably want to leave this blank
|
|
||||||
message: ""
|
|
||||||
# How many messages will be sent in order to clear chat
|
|
||||||
message-count: 100
|
|
||||||
|
|
||||||
language:
|
|
||||||
is-now-shadow-muted: '<yellow>Player <player> is now shadow muted!'
|
|
||||||
no-longer-shadow-muted: '<yellow>Player <player> is no longer shadow muted!'
|
|
||||||
shadow-mute-exempt: '<red>Player <player> is exempt from being shadow muted!'
|
|
||||||
is-now-muted: '<yellow>Player <player> is now muted!'
|
|
||||||
no-longer-muted: '<yellow>Player <player> is no longer muted!'
|
|
||||||
mute-exempt: '<red>Player <player> is exempt from being muted!'
|
|
||||||
reloaded: '<yellow>ChatModeration config has been reloaded!'
|
|
||||||
clear-notify: '<yellow>Chat has been cleared by <player>.'
|
|
||||||
clear-exempt: '<yellow>You were exempt from the clear due to your permissions!'
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
maven { url = "https://jitpack.io" }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
|
|
||||||
|
|
||||||
compileOnly project(':CarbonChat')
|
|
||||||
}
|
|
||||||
|
|
||||||
description = 'CarbonChatTowny'
|
|
||||||
|
|
||||||
bukkit {
|
|
||||||
name = description
|
|
||||||
version = project.version
|
|
||||||
main = 'net.draycia.carbontowny.CarbonChatTowny'
|
|
||||||
apiVersion = '1.13'
|
|
||||||
author = 'Draycia'
|
|
||||||
depend = ['CarbonChat', 'Towny']
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.build.dependsOn tasks.shadowJar
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
cancellation-message: "<red>You do not belong to a town!"
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
maven { url = "https://maven.enginehub.org/repo/" }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT'
|
|
||||||
|
|
||||||
compileOnly project(':CarbonChat')
|
|
||||||
}
|
|
||||||
|
|
||||||
description = 'CarbonChatWorldGuard'
|
|
||||||
|
|
||||||
bukkit {
|
|
||||||
name = description
|
|
||||||
version = project.version
|
|
||||||
main = 'net.draycia.carbonworldguard.CarbonChatWorldGuard'
|
|
||||||
apiVersion = '1.13'
|
|
||||||
author = 'Draycia'
|
|
||||||
depend = ['CarbonChat', 'WorldGuard']
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.build.dependsOn tasks.shadowJar
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
archiveFileName.set(project.name + "-" + project.property('projectVersion') + ".jar")
|
|
||||||
}
|
|
||||||
Whitespace-only changes.
@@ -6,6 +6,3 @@ rootProject.name = 'CarbonChatPlugin'
|
|||||||
|
|
||||||
include(':CarbonChat')
|
include(':CarbonChat')
|
||||||
include(':CarbonChatModeration')
|
include(':CarbonChatModeration')
|
||||||
include(':CarbonChatMCMMO')
|
|
||||||
include(':CarbonChatTowny')
|
|
||||||
include(':CarbonChatWorldGuard')
|
|
||||||
Reference in new issue
Block a user