Skip to content

Commit

Permalink
3.2-beta.6 (Changelog below)
Browse files Browse the repository at this point in the history
Changes:
- Commands can now have more than 1 alias across all platforms
- velocity-commands.yml file has been merged into commands.yml
- Automatic config updates are fully working now (All old configs should work, except for .lang files those are now unsupported)
- Fixed Velocity support
  • Loading branch information
Refrac committed Oct 17, 2023
1 parent 138fca6 commit 06f76af
Show file tree
Hide file tree
Showing 70 changed files with 2,039 additions and 1,190 deletions.
74 changes: 37 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.refracdevelopment</groupId>
<artifactId>SimpleStaffChat2</artifactId>
<version>3.2-beta.5</version>
<version>3.2-beta.6</version>
<packaging>jar</packaging>

<name>SimpleStaffChat2</name>
Expand All @@ -23,25 +23,33 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
</filters>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>me.refracdevelopment.simplestaffchat.libs</shadedPattern>
</relocation>
<relocation>
<pattern>dev.dejvokep.boostedyaml</pattern>
<shadedPattern>me.refracdevelopment.simplestaffchat.libs</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>me.refracdevelopment.libs.org.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>dev.rosewood.rosegarden</pattern>
<shadedPattern>me.refracdevelopment.libs.dev.rosewood.rosegarden</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -80,18 +88,10 @@
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
Expand All @@ -104,15 +104,15 @@

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.20-R0.1</version>
<groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -130,9 +130,14 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<version>2.11.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bungeecord</artifactId>
Expand All @@ -150,14 +155,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Refrac</groupId>
<artifactId>RoseGarden</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.github.Carleslc</groupId>
<artifactId>Simple-Yaml</artifactId>
<version>1.8.4</version>
<groupId>dev.dejvokep</groupId>
<artifactId>boosted-yaml</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.gson.JsonParser;
import lombok.Getter;
import me.refracdevelopment.simplestaffchat.bungee.api.BungeeStaffChatAPI;
import me.refracdevelopment.simplestaffchat.bungee.config.YMLBase;
import me.refracdevelopment.simplestaffchat.bungee.config.ConfigFile;
import me.refracdevelopment.simplestaffchat.bungee.config.cache.Commands;
import me.refracdevelopment.simplestaffchat.bungee.config.cache.Config;
import me.refracdevelopment.simplestaffchat.bungee.config.cache.Discord;
Expand All @@ -15,7 +15,6 @@
import me.refracdevelopment.simplestaffchat.bungee.utilities.LuckPermsUtil;
import me.refracdevelopment.simplestaffchat.bungee.utilities.Methods;
import me.refracdevelopment.simplestaffchat.bungee.utilities.chat.Color;
import me.refracdevelopment.simplestaffchat.bungee.utilities.chat.Placeholders;
import me.refracdevelopment.simplestaffchat.shared.Permissions;
import net.luckperms.api.LuckPermsProvider;
import net.md_5.bungee.api.CommandSender;
Expand All @@ -34,9 +33,9 @@ public class BungeeStaffChat extends Plugin {

private BungeeStaffChatAPI staffChatAPI;

private YMLBase configFile;
private YMLBase commandsFile;
private YMLBase discordFile;
private ConfigFile configFile;
private ConfigFile commandsFile;
private ConfigFile discordFile;

private Config config;
private Commands commands;
Expand All @@ -46,19 +45,20 @@ public class BungeeStaffChat extends Plugin {
private Methods methods;
private Permissions permissions;
private Color color;
private Placeholders placeholders;
private LuckPermsUtil luckPermsUtil;

@Override
public void onEnable() {
long startTiming = System.currentTimeMillis();

this.color = new Color(this);
this.placeholders = new Placeholders(this);
this.permissions = new Permissions();

loadFiles();

new Metrics(this, 12096);
this.color = new Color(this);
this.permissions = new Permissions();
this.discordImpl = new DiscordImpl(this);
this.methods = new Methods(this);

loadCommands();
loadListeners();

Expand All @@ -73,14 +73,10 @@ public void onEnable() {
"consider downloading https://www.spigotmc.org/resources/%E2%9C%A8-antipopup-bungeecord-viaversion-addon-%E2%9C%A8.104628/");
}

new Metrics(this, 12096);

this.staffChatAPI = new BungeeStaffChatAPI(this);
this.discordImpl = new DiscordImpl(this);
this.methods = new Methods(this);

this.color.log("&8&m==&c&m=====&f&m======================&c&m=====&8&m==");
this.color.log("&e" + getDescription().getName() + " has been enabled. (" + (System.currentTimeMillis() - startTiming) + "ms)");
this.color.log("&e" + getDescription().getName() + " has been enabled. (took " + (System.currentTimeMillis() - startTiming) + "ms)");
this.color.log(" &f[*] &6Version&f: &b" + getDescription().getVersion());
this.color.log(" &f[*] &6Name&f: &b" + getDescription().getName());
this.color.log(" &f[*] &6Author&f: &b" + getDescription().getAuthor());
Expand All @@ -90,24 +86,21 @@ public void onEnable() {
}

private void loadFiles() {
this.configFile = new YMLBase(this, "bungee-config.yml");
this.commandsFile = new YMLBase(this, "commands.yml");
this.discordFile = new YMLBase(this, "discord.yml");
// Files
this.configFile = new ConfigFile(this, "bungee-config.yml");
this.commandsFile = new ConfigFile(this, "commands.yml");
this.discordFile = new ConfigFile(this, "discord.yml");

// Caches
this.config = new Config(this);
this.commands = new Commands(this);
this.discord = new Discord(this);
this.config.loadConfig();
this.commands.loadConfig();
this.discord.loadConfig();
this.color.log("&c==========================================");
this.color.log("&eAll files have been loaded correctly!");
this.color.log("&c==========================================");
}

public void reloadFiles() {
this.configFile.load();
this.commandsFile.load();
this.discordFile.load();
this.configFile.reload();
this.commandsFile.reload();
this.discordFile.reload();
this.config.loadConfig();
this.commands.loadConfig();
this.discord.loadConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ChatCommand extends Command {
private final BungeeStaffChat plugin;

public ChatCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().CHAT_COMMAND, "", plugin.getCommands().CHAT_COMMAND_ALIAS);
super(plugin.getCommands().CHAT_COMMAND_ALIASES.get(0), "", plugin.getCommands().CHAT_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class HideCommand extends Command {
private final BungeeStaffChat plugin;

public HideCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().STAFF_HIDE_COMMAND, "", plugin.getCommands().STAFF_HIDE_COMMAND_ALIAS);
super(plugin.getCommands().STAFF_HIDE_COMMAND_ALIASES.get(0), "", plugin.getCommands().STAFF_HIDE_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class StaffChatCommand extends Command {
private final BungeeStaffChat plugin;

public StaffChatCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().STAFFCHAT_COMMAND, "", plugin.getCommands().STAFFCHAT_COMMAND_ALIAS);
super(plugin.getCommands().STAFFCHAT_COMMAND_ALIASES.get(0), "", plugin.getCommands().STAFFCHAT_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand All @@ -27,12 +27,18 @@ public void execute(CommandSender commandSender, String[] strings) {
}

if (strings.length >= 1) {
String format = (commandSender instanceof ProxiedPlayer) ? plugin.getConfig().STAFFCHAT_FORMAT.replace("%server%", ((ProxiedPlayer) commandSender).getServer().getInfo().getName())
.replace("%message%", message) : plugin.getConfig().CONSOLE_STAFFCHAT_FORMAT.replace("%message%", message);
String format = (commandSender instanceof ProxiedPlayer) ? plugin.getConfig().STAFFCHAT_FORMAT
.replace("%server%", ((ProxiedPlayer) commandSender).getServer().getInfo().getName())
.replace("%player%", commandSender.getName())
.replace("%message%", message) : plugin.getConfig().CONSOLE_STAFFCHAT_FORMAT
.replace("%server%", "N/A")
.replace("%player%", commandSender.getName())
.replace("%message%", message);

plugin.getMethods().sendStaffChat(commandSender, format);
} else {
if (plugin.getConfig().STAFFCHAT_OUTPUT.equalsIgnoreCase("custom") && plugin.getConfig().STAFFCHAT_MESSAGE != null) {
if (plugin.getConfig().STAFFCHAT_OUTPUT.equalsIgnoreCase("default") ||
plugin.getConfig().STAFFCHAT_OUTPUT.equalsIgnoreCase("custom")) {
if (!commandSender.hasPermission(plugin.getPermissions().STAFFCHAT_HELP)) {
plugin.getColor().sendMessage(commandSender, plugin.getConfig().NO_PERMISSION);
return;
Expand All @@ -47,27 +53,6 @@ public void execute(CommandSender commandSender, String[] strings) {

plugin.getMethods().toggleStaffChat(player);
}
} else {
if (!commandSender.hasPermission(plugin.getPermissions().STAFFCHAT_HELP)) {
plugin.getColor().sendMessage(commandSender, plugin.getConfig().NO_PERMISSION);
return;
}

plugin.getColor().sendMessage(commandSender, "");
plugin.getColor().sendMessage(commandSender, "&c&lSimpleStaffChat2 %arrow% Help");
plugin.getColor().sendMessage(commandSender, "");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().STAFFCHAT_COMMAND + " <message> - Send staffchat messages.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().STAFF_TOGGLE_COMMAND + " - Send staffchat messages without needing to type a command.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().ADMINCHAT_COMMAND + " <message> - Send adminchat messages.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().ADMIN_TOGGLE_COMMAND + " - Send adminchat messages without needing to type a command.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().DEVCHAT_COMMAND + " <message> - Send devchat messages.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().DEV_TOGGLE_COMMAND + " - Send devchat messages without needing to type a command.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().CHAT_COMMAND + " <type:staff|admin|dev> - Send chat messages without needing to type a command.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().STAFF_HIDE_COMMAND + " <type:staff|admin|dev> - Allows you to hide staffchat messages.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().ADMIN_HIDE_COMMAND + " <type:staff|admin|dev> - Allows you to hide adminchat messages.");
plugin.getColor().sendMessage(commandSender, "&c/" + plugin.getCommands().DEV_HIDE_COMMAND + " <type:staff|admin|dev> - Allows you to hide devchat messages.");
plugin.getColor().sendMessage(commandSender, "&c/staffchatreload - Reload the config file.");
plugin.getColor().sendMessage(commandSender, "");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ToggleCommand extends Command {
private final BungeeStaffChat plugin;

public ToggleCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().STAFF_TOGGLE_COMMAND, "", plugin.getCommands().STAFF_TOGGLE_COMMAND_ALIAS);
super(plugin.getCommands().STAFF_TOGGLE_COMMAND_ALIASES.get(0), "", plugin.getCommands().STAFF_TOGGLE_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AdminChatCommand extends Command {
private final BungeeStaffChat plugin;

public AdminChatCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().ADMINCHAT_COMMAND, "", plugin.getCommands().ADMINCHAT_COMMAND_ALIAS);
super(plugin.getCommands().ADMINCHAT_COMMAND_ALIASES.get(0), "", plugin.getCommands().ADMINCHAT_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand All @@ -27,8 +27,13 @@ public void execute(CommandSender commandSender, String[] strings) {
}

if (strings.length >= 1) {
String format = (commandSender instanceof ProxiedPlayer) ? plugin.getConfig().ADMINCHAT_FORMAT.replace("%server%", ((ProxiedPlayer) commandSender).getServer().getInfo().getName())
.replace("%message%", message) : plugin.getConfig().CONSOLE_ADMINCHAT_FORMAT.replace("%message%", message);
String format = (commandSender instanceof ProxiedPlayer) ? plugin.getConfig().ADMINCHAT_FORMAT
.replace("%server%", ((ProxiedPlayer) commandSender).getServer().getInfo().getName())
.replace("%player%", commandSender.getName())
.replace("%message%", message) : plugin.getConfig().CONSOLE_ADMINCHAT_FORMAT
.replace("%server%", "N/A")
.replace("%player%", commandSender.getName())
.replace("%message%", message);

plugin.getMethods().sendAdminChat(commandSender, format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AdminHideCommand extends Command {
private final BungeeStaffChat plugin;

public AdminHideCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().ADMIN_HIDE_COMMAND, "", plugin.getCommands().ADMIN_HIDE_COMMAND_ALIAS);
super(plugin.getCommands().ADMIN_HIDE_COMMAND_ALIASES.get(0), "", plugin.getCommands().ADMIN_HIDE_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AdminToggleCommand extends Command {
private final BungeeStaffChat plugin;

public AdminToggleCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().ADMIN_TOGGLE_COMMAND, "", plugin.getCommands().ADMIN_TOGGLE_COMMAND_ALIAS);
super(plugin.getCommands().ADMIN_TOGGLE_COMMAND_ALIASES.get(0), "", plugin.getCommands().ADMIN_TOGGLE_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class DevChatCommand extends Command {
private final BungeeStaffChat plugin;

public DevChatCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().DEVCHAT_COMMAND, "", plugin.getCommands().DEVCHAT_COMMAND_ALIAS);
super(plugin.getCommands().DEVCHAT_COMMAND_ALIASES.get(0), "", plugin.getCommands().DEVCHAT_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand All @@ -27,8 +27,13 @@ public void execute(CommandSender commandSender, String[] strings) {
}

if (strings.length >= 1) {
String format = (commandSender instanceof ProxiedPlayer) ? plugin.getConfig().DEVCHAT_FORMAT.replace("%server%", ((ProxiedPlayer) commandSender).getServer().getInfo().getName())
.replace("%message%", message) : plugin.getConfig().CONSOLE_DEVCHAT_FORMAT.replace("%message%", message);
String format = (commandSender instanceof ProxiedPlayer) ? plugin.getConfig().DEVCHAT_FORMAT
.replace("%server%", ((ProxiedPlayer) commandSender).getServer().getInfo().getName())
.replace("%player%", commandSender.getName())
.replace("%message%", message) : plugin.getConfig().CONSOLE_DEVCHAT_FORMAT
.replace("%server%", "N/A")
.replace("%player%", commandSender.getName())
.replace("%message%", message);

plugin.getMethods().sendDevChat(commandSender, format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class DevHideCommand extends Command {
private final BungeeStaffChat plugin;

public DevHideCommand(BungeeStaffChat plugin) {
super(plugin.getCommands().DEV_HIDE_COMMAND, "", plugin.getCommands().DEV_HIDE_COMMAND_ALIAS);
super(plugin.getCommands().DEV_HIDE_COMMAND_ALIASES.get(0), "", plugin.getCommands().DEV_HIDE_COMMAND_ALIASES.toArray(new String[0]));
this.plugin = plugin;
}

Expand Down
Loading

0 comments on commit 06f76af

Please sign in to comment.