Fix compilation and improve some features

This commit is contained in:
Draycia committed 2020-07-12 06:08:28 -07:00
1 parent ad8089855c
commit 2fb1eb0eb5
14 files changed
+45 -116

No files matched your search

+15 -45
View File
@@ -7,7 +7,7 @@
<parent>
<artifactId>SimpleChatParent</artifactId>
<groupId>net.draycia</groupId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<artifactId>SimpleChatModeration</artifactId>
@@ -24,48 +24,6 @@
<version>3.1.1</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>net.draycia.simplechat.libs.acf</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>net.draycia.simplechat.libs.locales</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.idb</pattern>
<shadedPattern>net.draycia.simplechat.libs.idb</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>net.draycia.simplechat.libs.kyori</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>net.draycia.simplechat.libs.paperlib</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml</pattern>
<shadedPattern>net.draycia.simplechat.libs.fasterxml</shadedPattern>
</relocation>
<relocation>
<pattern>com.neovisionaries</pattern>
<shadedPattern>net.draycia.simplechat.libs.neovisionaries</shadedPattern>
</relocation>
<relocation>
<pattern>okio</pattern>
<shadedPattern>net.draycia.simplechat.libs.okio</shadedPattern>
</relocation>
<relocation>
<pattern>okhttp3</pattern>
<shadedPattern>net.draycia.simplechat.libs.okhttp3</shadedPattern>
</relocation>
<relocation>
<pattern>org.checkerframework</pattern>
<shadedPattern>net.draycia.simplechat.libs.checkerframework</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
@@ -110,6 +68,13 @@
</resources>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
@@ -120,9 +85,14 @@
<dependency>
<groupId>net.draycia</groupId>
<artifactId>SimpleChat</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<classifier>shaded</classifier>
</dependency>
</dependencies>
@@ -5,7 +5,6 @@ import co.aikar.commands.CommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Default;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechatmoderation.SimpleChatModeration;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
@@ -5,11 +5,11 @@ import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Default;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.storage.ChatUser;
import net.draycia.simplechatmoderation.SimpleChatModeration;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.command.CommandSender;
@CommandAlias("mute")
@@ -28,11 +28,17 @@ public class MuteCommand extends BaseCommand {
String format;
if (targetUser.isMuted()) {
targetUser.setMuted(true);
targetUser.setMuted(false);
format = moderation.getConfig().getString("language.no-longer-muted");
} else {
targetUser.setMuted(false);
format = moderation.getConfig().getString("language.is-now-muted");
Permission permission = moderation.getSimpleChat().getPermission();
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "simplechat.mute.exempt")) {
format = moderation.getConfig().getString("language.mute-exempt");
} else {
targetUser.setMuted(true);
format = moderation.getConfig().getString("language.is-now-muted");
}
}
Component message = MiniMessage.get().parse(format, "br", "\n",
@@ -9,6 +9,7 @@ import net.draycia.simplechat.storage.ChatUser;
import net.draycia.simplechatmoderation.SimpleChatModeration;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.command.CommandSender;
@CommandAlias("shadowmute|sm|smute")
@@ -30,8 +31,14 @@ public class ShadowMuteCommand extends BaseCommand {
targetUser.setShadowMuted(false);
format = moderation.getConfig().getString("language.no-longer-shadow-muted");
} else {
targetUser.setShadowMuted(true);
format = moderation.getConfig().getString("language.is-now-shadow-muted");
Permission permission = moderation.getSimpleChat().getPermission();
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "simplechat.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 = MiniMessage.get().parse(format, "br", "\n",
@@ -1,4 +1,4 @@
package net.draycia.simplechat.listeners;
package net.draycia.simplechatmoderation.listeners;
import net.draycia.simplechat.events.ChatFormatEvent;
import org.bukkit.event.EventHandler;
@@ -1,4 +1,4 @@
package net.draycia.simplechat.listeners;
package net.draycia.simplechatmoderation.listeners;
import net.draycia.simplechat.events.ChatComponentEvent;
import org.bukkit.event.EventHandler;
@@ -22,8 +22,10 @@ clear-chat:
language:
is-now-shadow-muted: '<yellow>User <user> is now shadow muted!'
no-longer-shadow-muted: '<yellow>User <user> is no longer shadow muted!'
shadow-mute-exempt: '<red>User <user> is exempt from being shadow muted!'
is-now-muted: '<yellow>User <user> is now muted!'
no-longer-muted: '<yellow>User <user> is no longer muted!'
mute-exempt: '<red>User <user> 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 -44
View File
@@ -7,7 +7,7 @@
<parent>
<artifactId>SimpleChatParent</artifactId>
<groupId>net.draycia</groupId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<artifactId>SimpleChat</artifactId>
@@ -23,50 +23,7 @@
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>net.draycia.simplechat.libs.acf</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>net.draycia.simplechat.libs.locales</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.idb</pattern>
<shadedPattern>net.draycia.simplechat.libs.idb</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>net.draycia.simplechat.libs.kyori</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>net.draycia.simplechat.libs.paperlib</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml</pattern>
<shadedPattern>net.draycia.simplechat.libs.fasterxml</shadedPattern>
</relocation>
<relocation>
<pattern>com.neovisionaries</pattern>
<shadedPattern>net.draycia.simplechat.libs.neovisionaries</shadedPattern>
</relocation>
<relocation>
<pattern>okio</pattern>
<shadedPattern>net.draycia.simplechat.libs.okio</shadedPattern>
</relocation>
<relocation>
<pattern>okhttp3</pattern>
<shadedPattern>net.draycia.simplechat.libs.okhttp3</shadedPattern>
</relocation>
<relocation>
<pattern>org.checkerframework</pattern>
<shadedPattern>net.draycia.simplechat.libs.checkerframework</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
@@ -1,13 +1,11 @@
package net.draycia.simplechat.channels;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.events.ChatFormatEvent;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public abstract class ChatChannel {
@@ -1,17 +1,11 @@
package net.draycia.simplechat.channels.impls;
import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.event.NationRemoveTownEvent;
import com.palmergames.bukkit.towny.event.TownRemoveResidentEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.storage.ChatUser;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class AllianceChatChannel extends NationChatChannel implements Listener {
@@ -1,7 +1,6 @@
package net.draycia.simplechat.channels.impls;
import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.event.TownAddResidentEvent;
import com.palmergames.bukkit.towny.event.TownRemoveResidentEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
@@ -5,7 +5,6 @@ import co.aikar.commands.annotation.*;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.draycia.simplechat.storage.UserChannelSettings;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -30,19 +30,17 @@ import java.lang.reflect.Method;
public final class ItemStackUtils {
private final Class<?> craftItemStackClass;
private final Method asNMSCopyMethod;
private final Class<?> itemStackClass;
private final Method cMethod;
public ItemStackUtils() throws NoSuchMethodException, ClassNotFoundException {
final String version = Bukkit.getServer().getClass().getPackage().getName()
.substring("org.bukkit.craftbukkit.".length());
this.craftItemStackClass = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack");
this.asNMSCopyMethod = this.craftItemStackClass.getMethod("asNMSCopy", ItemStack.class);
this.itemStackClass = Class.forName("net.minecraft.server." + version + ".ItemStack");
this.cMethod = this.itemStackClass.getMethod("C");
Class<?> craftItemStackClass = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack");
this.asNMSCopyMethod = craftItemStackClass.getMethod("asNMSCopy", ItemStack.class);
Class<?> itemStackClass = Class.forName("net.minecraft.server." + version + ".ItemStack");
this.cMethod = itemStackClass.getMethod("C");
}
public Component createComponent(final Player player) {
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>net.draycia</groupId>
<artifactId>SimpleChatParent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<modules>
<module>SimpleChatPlugin</module>
@@ -15,7 +15,7 @@
<packaging>pom</packaging>
<name>SimpleChat</name>
<name>SimpleChatParent</name>
<properties>
<java.version>1.8</java.version>