diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78ecb1d..52d4581 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,10 +19,10 @@ jobs: java-version: '20' distribution: 'adopt' - - name: Build Cirrus API - run: mvn install:install-file -Dfile=ace-velocity/libs/cirrus-api-3.0.0-SNAPSHOT.jar -DgroupId=dev.simplix.cirrus -DartifactId=cirrus-api -Dversion=3.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true - - name: Build Cirrus Velocity - run: mvn install:install-file -Dfile=ace-velocity/libs/cirrus-velocity-3.0.0-SNAPSHOT.jar -DgroupId=dev.simplix.cirrus -DartifactId=cirrus-velocity -Dversion=3.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true +# - name: Build Cirrus API +# run: mvn install:install-file -Dfile=ace-velocity/libs/cirrus-api-3.0.0-SNAPSHOT.jar -DgroupId=dev.simplix.cirrus -DartifactId=cirrus-api -Dversion=3.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true +# - name: Build Cirrus Velocity +# run: mvn install:install-file -Dfile=ace-velocity/libs/cirrus-velocity-3.0.0-SNAPSHOT.jar -DgroupId=dev.simplix.cirrus -DartifactId=cirrus-velocity -Dversion=3.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true - name: Build with Maven run: mvn -B package --file pom.xml diff --git a/ace-velocity/dependency-reduced-pom.xml b/ace-velocity/dependency-reduced-pom.xml index c467e0f..8d446d2 100644 --- a/ace-velocity/dependency-reduced-pom.xml +++ b/ace-velocity/dependency-reduced-pom.xml @@ -18,11 +18,32 @@ true - src/main/resources + src/main/java/resources + + velocity-plugin.json + ${project.name} + + net.md-5 + scriptus + 0.2 + + + initialize + + describe + + + git-Ace-%s + ${project.basedir} + ace.desc + + + + maven-shade-plugin 3.4.1 @@ -48,6 +69,10 @@ co.aikar. com.bongbong.ace.co.aikar. + + dev.simplix. + com.bongbong.ace.dev.simplix. + @@ -109,20 +134,6 @@ 1.18.24 provided - - dev.simplix.cirrus - cirrus-velocity - 3.0.0-SNAPSHOT - system - ${project.basedir}/libs/cirrus-velocity-3.0.0-SNAPSHOT.jar - - - dev.simplix.cirrus - cirrus-api - 3.0.0-SNAPSHOT - system - ${project.basedir}/libs/cirrus-api-3.0.0-SNAPSHOT.jar - 20 diff --git a/ace-velocity/pom.xml b/ace-velocity/pom.xml index 624dd8f..a20b166 100644 --- a/ace-velocity/pom.xml +++ b/ace-velocity/pom.xml @@ -17,6 +17,8 @@ UTF-8 + + aikar @@ -49,6 +51,16 @@ 2.4.1 provided + + + + + + + + + + org.mongodb mongodb-driver-sync @@ -83,24 +95,17 @@ 6.0.53 provided - - dev.simplix.cirrus - cirrus-velocity - 3.0.0-SNAPSHOT - - - dev.simplix.cirrus - cirrus-api - 3.0.0-SNAPSHOT - ${project.name} - src/main/resources + src/main/java/resources true + + velocity-plugin.json + diff --git a/ace-velocity/src/main/java/com/bongbong/ace/velocity/AcePlugin.java b/ace-velocity/src/main/java/com/bongbong/ace/velocity/AcePlugin.java index fea275a..06a504f 100644 --- a/ace-velocity/src/main/java/com/bongbong/ace/velocity/AcePlugin.java +++ b/ace-velocity/src/main/java/com/bongbong/ace/velocity/AcePlugin.java @@ -8,6 +8,8 @@ import com.bongbong.ace.velocity.profiles.ProfileManager; import com.bongbong.ace.velocity.staff.StaffManager; import com.bongbong.ace.velocity.utils.*; +import com.google.common.io.Resources; +import com.google.gson.Gson; import com.google.inject.Inject; import com.mongodb.ConnectionString; import com.mongodb.MongoClientSettings; @@ -20,12 +22,17 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ProxyServer; -import dev.simplix.cirrus.velocity.CirrusVelocity; -import dev.simplix.cirrus.velocity.plugin.CirrusTestCommand; +//import dev.simplix.cirrus.velocity.CirrusVelocity; import net.elytrium.limboapi.api.LimboFactory; import org.bson.UuidRepresentation; +import org.json.JSONObject; +import java.io.IOException; +import java.net.URL; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; +import java.util.Optional; +import java.util.Properties; import java.util.logging.Logger; @Plugin( @@ -49,6 +56,7 @@ public class AcePlugin { public AcePlugin(ProxyServer server, Logger logger) { this.server = server; this.logger = logger; + } @Subscribe @@ -114,9 +122,9 @@ public void onProxyInitialization(ProxyInitializeEvent event) { LimboFactory limboFactory = (LimboFactory) server.getPluginManager() .getPlugin("limboapi").flatMap(PluginContainer::getInstance).orElseThrow(); - - new CirrusVelocity(this, server, server.getCommandManager()).init(); - server.getCommandManager().register("menu", new CirrusTestCommand()); +// +// new CirrusVelocity(this, server, server.getCommandManager()).init(); +// server.getCommandManager().register("menu", new CirrusTestCommand()); new ProfileManager( taskScheduler, mongo, commandManager, playerFinder, locale, redisManager, registrar, diff --git a/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/commands/HistoryCommand.java b/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/commands/HistoryCommand.java index 43605d4..b528c90 100644 --- a/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/commands/HistoryCommand.java +++ b/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/commands/HistoryCommand.java @@ -10,12 +10,12 @@ import com.bongbong.ace.velocity.staff.punishments.Punishment; import com.bongbong.ace.velocity.staff.punishments.PunishmentManager; import com.bongbong.ace.velocity.staff.punishments.PunishmentProfile; -import com.bongbong.ace.velocity.staff.punishments.menus.HistoryMenu; +//import com.bongbong.ace.velocity.staff.punishments.menus.HistoryMenu; import com.bongbong.ace.velocity.utils.Colors; import com.bongbong.ace.velocity.utils.OfflinePlayer; import com.bongbong.ace.velocity.utils.PlayerFinder; import com.velocitypowered.api.proxy.Player; -import dev.simplix.cirrus.velocity.wrapper.VelocityPlayerWrapper; +//import dev.simplix.cirrus.velocity.wrapper.VelocityPlayerWrapper; import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.event.HoverEvent; @@ -42,9 +42,9 @@ public void history(CommandIssuer issuer, PunishmentProfile target, @Optional St if (issuerPlayer != null && (chatToggle == null || !chatToggle.contains("-dump"))) { TreeMap map = new TreeMap<>(); for (Punishment punishment : punishments) map.put(punishment.getIssued(), punishment); - - VelocityPlayerWrapper velocityPlayerWrapper = new VelocityPlayerWrapper(issuerPlayer); - new HistoryMenu(playerFinder, map).display(velocityPlayerWrapper); +// +// VelocityPlayerWrapper velocityPlayerWrapper = new VelocityPlayerWrapper(issuerPlayer); +// new HistoryMenu(playerFinder, map).display(velocityPlayerWrapper); return; } diff --git a/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/menus/HistoryMenu.java b/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/menus/HistoryMenu.java index 5c16452..a8a98df 100644 --- a/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/menus/HistoryMenu.java +++ b/ace-velocity/src/main/java/com/bongbong/ace/velocity/staff/punishments/menus/HistoryMenu.java @@ -1,128 +1,128 @@ -package com.bongbong.ace.velocity.staff.punishments.menus; - -import com.bongbong.ace.shared.utils.DateFormatter; -import com.bongbong.ace.velocity.staff.punishments.Punishment; -import com.bongbong.ace.velocity.utils.Colors; -import com.bongbong.ace.velocity.utils.OfflinePlayer; -import com.bongbong.ace.velocity.utils.PlayerFinder; -import dev.simplix.cirrus.item.CirrusItem; -import dev.simplix.cirrus.menu.MenuRow; -import dev.simplix.cirrus.menus.AbstractBrowser; -import dev.simplix.cirrus.model.Click; -import dev.simplix.protocolize.data.ItemType; -import dev.simplix.protocolize.data.inventory.InventoryType; - -import java.util.*; - -public class HistoryMenu extends AbstractBrowser { - - private final PlayerFinder playerFinder; - private final TreeMap map; - private int position = 0; - - public HistoryMenu(PlayerFinder playerFinder, TreeMap map) { - this.playerFinder = playerFinder; - this.map = map; - - fixedSize(InventoryType.GENERIC_9X2); - title(Colors.translate("&eHistory Menu (Total: " + map.size() + ")")); - } - - @Override - protected void interceptBottomRow(MenuRow bottomRow) { - bottomRow.get(0).set(CirrusItem.of(ItemType.ARROW, - hasPreviousPage() ? Colors.translate("&aPrevious page") : Colors.translate("&cPrevious Page"), - hasPreviousPage() ? Colors.translate("&7Click to view the previous page.") : Colors.translate("&7This is the first page.") - ).actionHandler("previousPage")); - - bottomRow.get(8).set(CirrusItem.of(ItemType.ARROW, - hasNextPage() ? Colors.translate("&aNext page") : Colors.translate("&cNext Page"), - hasNextPage() ? Colors.translate("&7Click to view the next page.") : Colors.translate("&7This is the last page.") - ).actionHandler("nextPage")); - } - - @Override - protected void handleClick(Click click, ItemType value) { - click.player().sendMessage(Colors.translate("&aPunishment info dump coming soon")); - } - - @Override - protected Collection elements() { - Collection collection = new ArrayList<>(); - for (Punishment punishment : map.descendingMap().values()) { - switch (punishment.getType()) { - case BAN: { collection.add(ItemType.DIAMOND_SWORD); continue; } - case BLACKLIST: { collection.add(ItemType.BEDROCK); continue; } - case MUTE: { collection.add(ItemType.WRITABLE_BOOK); continue; } - case KICK: { collection.add(ItemType.GOLDEN_BOOTS); continue; } - default: { collection.add(ItemType.PAPER); } - } - } - - return collection; - } - - @Override - protected CirrusItem map(ItemType element) { - Punishment punishment = null; - int count = 0; - - for (Punishment punishment1 : map.descendingMap().values()) { - if (position == count) { - punishment = punishment1; - break; - } - - count++; - } - position++; - - if (punishment == null) return null; - - String issuerName = null; - if (punishment.getIssuer() == null) issuerName = "Console"; - else { - OfflinePlayer issuerPlayer = playerFinder.getOPlayerFromUUID(punishment.getIssuer()); - if (issuerPlayer != null) issuerName = issuerPlayer.getUsername(); - } - - String victimName = null; - OfflinePlayer victimPlayer = playerFinder.getOPlayerFromUUID(punishment.getVictim()); - if (victimPlayer != null) victimName = victimPlayer.getUsername(); - - List lore = new ArrayList<>(); - - lore.add(""); - lore.add(Colors.translate("&eTarget: &f" + victimName)); - lore.add(Colors.translate("&eDuration: &f" + punishment.originalDuration())); - lore.add(""); - lore.add(Colors.translate("&eIssued By: &f" + issuerName)); - lore.add(Colors.translate("&eIssued Date: &f" + DateFormatter.format(punishment.getIssued()))); - lore.add(Colors.translate("&eIssued Reason: &f" + punishment.getIssueReason())); - - if (!punishment.isActive()) { - String pardonerName = "Console"; - Date pardonDate = punishment.getExpires(); - String pardonReason = "Expired"; - - if (punishment.getPardoned() != null) { - pardonReason = punishment.getPardonReason(); - pardonDate = punishment.getPardoned(); - - if (punishment.getPardoner() != null) { - OfflinePlayer pardonerPlayer = playerFinder.getOPlayerFromUUID(punishment.getPardoner()); - if (pardonerPlayer != null) pardonerName = pardonerPlayer.getUsername(); - } - } - - lore.add(""); - lore.add(Colors.translate("&eRemoved By: &f" + pardonerName)); - lore.add(Colors.translate("&eRemoved Date: &f" + DateFormatter.format(pardonDate))); - lore.add(Colors.translate("&eRemoved Reason: &f" + pardonReason)); - } - - return CirrusItem.of(element) - .displayName(Colors.translate("&7" + punishment.getType().toString().toUpperCase() + " (#" + punishment.getId() + ")")) - .lore(lore); - } -} +//package com.bongbong.ace.velocity.staff.punishments.menus; +// +//import com.bongbong.ace.shared.utils.DateFormatter; +//import com.bongbong.ace.velocity.staff.punishments.Punishment; +//import com.bongbong.ace.velocity.utils.Colors; +//import com.bongbong.ace.velocity.utils.OfflinePlayer; +//import com.bongbong.ace.velocity.utils.PlayerFinder; +//import dev.simplix.cirrus.item.CirrusItem; +//import dev.simplix.cirrus.menu.MenuRow; +//import dev.simplix.cirrus.menus.AbstractBrowser; +//import dev.simplix.cirrus.model.Click; +//import dev.simplix.protocolize.data.ItemType; +//import dev.simplix.protocolize.data.inventory.InventoryType; +// +//import java.util.*; +// +//public class HistoryMenu extends AbstractBrowser { +// +// private final PlayerFinder playerFinder; +// private final TreeMap map; +// private int position = 0; +// +// public HistoryMenu(PlayerFinder playerFinder, TreeMap map) { +// this.playerFinder = playerFinder; +// this.map = map; +// +// fixedSize(InventoryType.GENERIC_9X2); +// title(Colors.translate("&eHistory Menu (Total: " + map.size() + ")")); +// } +// +// @Override +// protected void interceptBottomRow(MenuRow bottomRow) { +// bottomRow.get(0).set(CirrusItem.of(ItemType.ARROW, +// hasPreviousPage() ? Colors.translate("&aPrevious page") : Colors.translate("&cPrevious Page"), +// hasPreviousPage() ? Colors.translate("&7Click to view the previous page.") : Colors.translate("&7This is the first page.") +// ).actionHandler("previousPage")); +// +// bottomRow.get(8).set(CirrusItem.of(ItemType.ARROW, +// hasNextPage() ? Colors.translate("&aNext page") : Colors.translate("&cNext Page"), +// hasNextPage() ? Colors.translate("&7Click to view the next page.") : Colors.translate("&7This is the last page.") +// ).actionHandler("nextPage")); +// } +// +// @Override +// protected void handleClick(Click click, ItemType value) { +// click.player().sendMessage(Colors.translate("&aPunishment info dump coming soon")); +// } +// +// @Override +// protected Collection elements() { +// Collection collection = new ArrayList<>(); +// for (Punishment punishment : map.descendingMap().values()) { +// switch (punishment.getType()) { +// case BAN: { collection.add(ItemType.DIAMOND_SWORD); continue; } +// case BLACKLIST: { collection.add(ItemType.BEDROCK); continue; } +// case MUTE: { collection.add(ItemType.WRITABLE_BOOK); continue; } +// case KICK: { collection.add(ItemType.GOLDEN_BOOTS); continue; } +// default: { collection.add(ItemType.PAPER); } +// } +// } +// +// return collection; +// } +// +// @Override +// protected CirrusItem map(ItemType element) { +// Punishment punishment = null; +// int count = 0; +// +// for (Punishment punishment1 : map.descendingMap().values()) { +// if (position == count) { +// punishment = punishment1; +// break; +// } +// +// count++; +// } +// position++; +// +// if (punishment == null) return null; +// +// String issuerName = null; +// if (punishment.getIssuer() == null) issuerName = "Console"; +// else { +// OfflinePlayer issuerPlayer = playerFinder.getOPlayerFromUUID(punishment.getIssuer()); +// if (issuerPlayer != null) issuerName = issuerPlayer.getUsername(); +// } +// +// String victimName = null; +// OfflinePlayer victimPlayer = playerFinder.getOPlayerFromUUID(punishment.getVictim()); +// if (victimPlayer != null) victimName = victimPlayer.getUsername(); +// +// List lore = new ArrayList<>(); +// +// lore.add(""); +// lore.add(Colors.translate("&eTarget: &f" + victimName)); +// lore.add(Colors.translate("&eDuration: &f" + punishment.originalDuration())); +// lore.add(""); +// lore.add(Colors.translate("&eIssued By: &f" + issuerName)); +// lore.add(Colors.translate("&eIssued Date: &f" + DateFormatter.format(punishment.getIssued()))); +// lore.add(Colors.translate("&eIssued Reason: &f" + punishment.getIssueReason())); +// +// if (!punishment.isActive()) { +// String pardonerName = "Console"; +// Date pardonDate = punishment.getExpires(); +// String pardonReason = "Expired"; +// +// if (punishment.getPardoned() != null) { +// pardonReason = punishment.getPardonReason(); +// pardonDate = punishment.getPardoned(); +// +// if (punishment.getPardoner() != null) { +// OfflinePlayer pardonerPlayer = playerFinder.getOPlayerFromUUID(punishment.getPardoner()); +// if (pardonerPlayer != null) pardonerName = pardonerPlayer.getUsername(); +// } +// } +// +// lore.add(""); +// lore.add(Colors.translate("&eRemoved By: &f" + pardonerName)); +// lore.add(Colors.translate("&eRemoved Date: &f" + DateFormatter.format(pardonDate))); +// lore.add(Colors.translate("&eRemoved Reason: &f" + pardonReason)); +// } +// +// return CirrusItem.of(element) +// .displayName(Colors.translate("&7" + punishment.getType().toString().toUpperCase() + " (#" + punishment.getId() + ")")) +// .lore(lore); +// } +//}