Clear out unneeded dependencies

This commit is contained in:
NotAlexNoyle committed 2024-08-10 12:13:45 +00:00
1 parent 6c238c73ae
commit 2e1f951978
192 files changed
+289 -13

No files matched your search

-11
View File
@@ -35,11 +35,6 @@ repositories {
url = uri("https://repo.purpurmc.org/snapshots")
}
// SuperVanish repository
maven {
url = uri("https://mavenrepo.cubekrowd.net/artifactory/repo/")
}
// VaultAPI repository
maven {
url = uri("https://jitpack.io")
@@ -58,9 +53,6 @@ dependencies {
// SLF4J
implementation("org.slf4j:slf4j-nop:1.7.25")
// SuperVanish
compileOnly("de.myzelyam:SuperVanish:6.0.4")
// TokenManager
compileOnly("com.github.Realizedd:TokenManager:3.2.4") {
exclude(group = "*", module = "*")
@@ -70,9 +62,6 @@ dependencies {
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
exclude(group = "org.bukkit", module = "bukkit")
}
// JetBrains Annotations
compileOnly("org.jetbrains:annotations:16.0.2")
}
tasks.withType<AbstractArchiveTask>().configureEach {
+44
View File
@@ -0,0 +1,44 @@
// This is free and unencumbered software released into the public domain.
// Author: NotAlexNoyle.
package plugin;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
// Import libraries.
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import net.trueog.diamondbankog.DiamondBankOG;
import net.trueog.diamondbankog.PostgreSQL;
// Hook into Bukkit's Listener.
public class Listeners implements Listener {
// Perform this plugin's action before other plugins actions.
/*@EventHandler(priority = EventPriority.HIGHEST)
// When a block is broken, do this...
public void onBlockBreak(BlockBreakEvent event) {
// Open a spectator GUI for the player who broke the block.
new SpectatorGui(TemplateOG.getPlugin(), event.getPlayer()).open(true);
try {
CompletableFuture<PostgreSQL.PlayerBalance> playerBalance = DiamondBankOG.getPlayerBalance(event.getPlayer().getUniqueId(), PostgreSQL.BalanceType.ALL);
Utils.templateOGPlaceholderMessage(event.getPlayer(), "Your current balance is: &B" + playerBalance.get());
}
catch (InterruptedException | ExecutionException error) {
Utils.templateOGPlaceholderMessage(event.getPlayer(), "&cERROR: Your balance could not be fetched! " + error.getMessage());
}
}
*/
}
+105
View File
@@ -0,0 +1,105 @@
// This is free and unencumbered software released into the public domain.
// Author: NotAlexNoyle.
package plugin;
// Import libraries.
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import uk.hotten.gxui.GUIBase;
import uk.hotten.gxui.GUIButton;
import uk.hotten.gxui.GUIItem;
public class SpectatorGui extends GUIBase {
private Player assignedPlayer;
public SpectatorGui(JavaPlugin plugin, Player player) {
super(plugin, player, "&3&lTest GUI", 9, true);
assignedPlayer = player;
}
@Override
public void setupItems() {
int curr = 0;
GUIItem item = null;
List<String> name = new ArrayList<String>(18);
for (Player p : Bukkit.getOnlinePlayers()) {
// Add a new element to the list for each player.
name.add("&eTeleport to: &d&l" + p.getName());
}
for (Player p : Bukkit.getOnlinePlayers()) {
item = new GUIItem(Material.PLAYER_HEAD, 1, name.get(curr), p.getName());
GUIButton guibutton = new GUIButton() {
@Override
public boolean leftClick() {
assignedPlayer.closeInventory();
assignedPlayer.teleport(p);
return true;
}
@Override public boolean leftClickShift() { return false; }
@Override public boolean rightClick() { return false; }
@Override public boolean rightClickShift() { return false; }
};
item.button(guibutton);
addItem(curr, item);
curr = nextCurr(curr);
}
}
private int nextCurr(int curr) {
if (curr == 3) {
return 6;
}
else {
return (curr += 1);
}
}
public static ArrayList<TextComponent> convertToTextComponents(List<String> stringList) {
ArrayList<TextComponent> textComponents = new ArrayList<TextComponent>(18);
for (String str : stringList) {
TextComponent textComponent = LegacyComponentSerializer.legacyAmpersand().deserialize(str);
textComponents.add(textComponent);
}
return textComponents;
}
}
+48
View File
@@ -0,0 +1,48 @@
package plugin;
import org.bukkit.plugin.java.JavaPlugin;
public class TemplateOG extends JavaPlugin {
private static TemplateOG plugin;
public void onEnable() {
plugin = this;
getServer().getPluginManager().registerEvents(new Listeners(), this);
//registerExpansion();
}
public static TemplateOG getPlugin() {
return plugin;
}
/*public void registerExpansion() {
// Create <diamondbankog_balance> placeholder.
Expansion expansion = Expansion.builder("diamondbankog").globalPlaceholder("balance", (queue, ctx) -> {
CompletableFuture<Double> balanceFuture = DiamondBankOG.getPlayerBalance(player.getUniqueId(), BalanceType.ALL);
double balance = 0.0;
try {
balance = balanceFuture.get(); // This might block the current thread
if (balance != null) {
System.out.println("Player balance: " + balance);
} else {
System.out.println("Player balance could not be retrieved.");
}
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error getting balance: " + e.getMessage());
}
return Tag.selfClosingInserting(Component.text(balance));
}).build();
expansion.register();
}*/
}
+90
View File
@@ -0,0 +1,90 @@
package plugin;
import org.bukkit.entity.Player;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class Utils {
// Sends a formatted message to the player (including name replacement).
public static void templateOGPlaceholderMessage(Player p, String message) {
p.sendMessage(legacySerializerAnyCase((message)));
}
public static TextComponent legacySerializerAnyCase(String subject) {
int count = 0;
// Count the number of '&' characters to determine the size of the array
for (char c : subject.toCharArray()) {
if (c == '&') {
count++;
}
}
// Create an array to store the positions of '&' characters
int[] positions = new int[count];
int index = 0;
// Find the positions of '&' characters and store in the array
for (int i = 0; i < subject.length(); i++) {
if (subject.charAt(i) == '&') {
if (isUpperBukkitCode(subject.charAt(i + 1))) {
subject = replaceCharAtIndex(subject, (i + 1), Character.toLowerCase(subject.charAt(i + 1)));
}
positions[index++] = i;
}
}
return LegacyComponentSerializer.legacyAmpersand().deserialize(subject);
}
private static boolean isUpperBukkitCode(char input) {
char[] bukkitColorCodes = {'A', 'B', 'C', 'D', 'E', 'F', 'K', 'L', 'M', 'N', 'O', 'R'};
boolean match = false;
// Loop through each character in the array.
for (char c : bukkitColorCodes) {
// Check if the current character in the array is equal to the input character.
if (c == input) {
match = true;
}
}
return match;
}
private static String replaceCharAtIndex(String original, int index, char newChar) {
// Check if the index is valid
if (index >= 0 && index < original.length()) {
// Create a new string with the replaced character
return original.substring(0, index) + newChar + original.substring(index + 1);
}
// If the index is invalid, return the original string
return original;
}
}
Loaded 100 of 192 files, more files were not shown because too many files have changed in this diff. Show more