Files
src
build.gradle
Code
25 3,021
src/main/java/com/deadlyxplayz/deadlysouls/DeadlySouls.java
package com.deadlyxplayz.deadlysouls;
import com.deadlyxplayz.deadlysouls.commands.DSCommand;
import com.deadlyxplayz.deadlysouls.inventory.gui.GUIListener;
import com.deadlyxplayz.deadlysouls.inventory.gui.GUIManager;
import com.deadlyxplayz.deadlysouls.listeners.PlayerListener;
import com.deadlyxplayz.deadlysouls.listeners.PurgatoryListener;
import com.deadlyxplayz.deadlysouls.listeners.SoulListener;
import com.deadlyxplayz.deadlysouls.managers.*;
import com.deadlyxplayz.deadlysouls.utils.ColorUtil;
import lombok.Getter;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
public class DeadlySouls extends JavaPlugin {
public static final String PREFIX = ColorUtil.color("&8[&5&lDeadly&dSouls&8] &r");
public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_BRIGHT = "\u001B[1m";
@Getter private static DeadlySouls instance;
@Getter private PlayerDataManager playerDataManager;
@Getter private SoulManager soulManager;
@Getter private CombatManager combatManager;
@Getter private PurgatoryManager purgatoryManager;
@Getter private HologramManager hologramManager;
@Getter private MobAmbushManager mobAmbushManager;
@Getter private GUIManager guiManager;
@Getter private PlayerListener playerListener;
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
flashBranding();
// Init managers
playerDataManager = new PlayerDataManager(this);
soulManager = new SoulManager(this);
combatManager = new CombatManager(this);
purgatoryManager = new PurgatoryManager(this);
hologramManager = new HologramManager(this);
mobAmbushManager = new MobAmbushManager(this);
guiManager = new GUIManager();
// Init listeners
playerListener = new PlayerListener(this);
Bukkit.getPluginManager().registerEvents(playerListener, this);
Bukkit.getPluginManager().registerEvents(new SoulListener(this), this);
Bukkit.getPluginManager().registerEvents(new PurgatoryListener(this), this);
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
// Commands
DSCommand dsCommand = new DSCommand(this);
getCommand("ds").setExecutor(dsCommand);
getCommand("ds").setTabCompleter(dsCommand);
// Global tasks
startGlobalTasks();
getLogger().info(PREFIX + "DeadlySouls enabled! by DEADLY_XPLAYZ");
}
@Override
public void onDisable() {
playerDataManager.saveAll();
hologramManager.cleanupAll();
getLogger().info(PREFIX + "DeadlySouls disabled. Data saved.");
}
private void startGlobalTasks() {
// Action bar — lives display, every 20 ticks (no flicker)
new BukkitRunnable() {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
var data = playerDataManager.getData(player.getUniqueId());
int lives = data.getLives();
StringBuilder hearts = new StringBuilder();
for (int i = 0; i < Math.min(lives, 20); i++) hearts.append("❤");
String livesColor = lives >= 4 ? "�FF44" : lives >= 2 ? "&#FF7700" : "&#FF0000";
String actionBar = ColorUtil.color(livesColor + "❤ Lives: " + lives + " " +
(hearts.length() > 0 ? "&7[" + livesColor + hearts + "&7]" : "") +
(data.isInPurgatory() ? " ᕼAA☠ PURGATORY" : "") +
(data.getBloodlustExpiry() > System.currentTimeMillis() ? " &#FF0000⚡ BLOODLUST" : "") +
(combatManager.isTagged(player) ? " &#FF4400⚔ Combat: " + combatManager.getTagRemaining(player) + "s" : ""));
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(actionBar));
}
}
}.runTaskTimer(this, 0L, 20L);
// Passive soul effects — every 60 ticks (3 sec), short-duration effects reapplied
new BukkitRunnable() {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
soulManager.applyPassiveEffects(player);
}
}
}.runTaskTimer(this, 20L, 60L);
// Particle auras — every 8 ticks (smooth but not laggy)
new BukkitRunnable() {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
soulManager.spawnAura(player);
}
}
}.runTaskTimer(this, 10L, 8L);
}
private void flashBranding() {
String[] lines = {
"",
ANSI_PURPLE + ANSI_BRIGHT + " ██████╗ ███████╗ █████╗ ██████╗ ██╗ ██╗ ██╗" + ANSI_RESET,
ANSI_PURPLE + ANSI_BRIGHT + " ██╔══██╗██╔════╝██╔══██╗██╔══██╗██║ ╚██╗ ██╔╝" + ANSI_RESET,
ANSI_CYAN + ANSI_BRIGHT + " ██║ ██║█████╗ ███████║██║ ██║██║ ╚████╔╝ " + ANSI_RESET,
ANSI_CYAN + ANSI_BRIGHT + " ██║ ██║██╔══╝ ██╔══██║██║ ██║██║ ╚██╔╝ " + ANSI_RESET,
ANSI_RED + ANSI_BRIGHT + " ██████╔╝███████╗██║ ██║██████╔╝███████╗██║ " + ANSI_RESET,
ANSI_RED + ANSI_BRIGHT + " ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ " + ANSI_RESET,
"",
ANSI_YELLOW + ANSI_BRIGHT + " ███████╗ ██████╗ ██╗ ██╗██╗ ███████╗" + ANSI_RESET,
ANSI_YELLOW + ANSI_BRIGHT + " ██╔════╝██╔═══██╗██║ ██║██║ ██╔════╝" + ANSI_RESET,
ANSI_CYAN + ANSI_BRIGHT + " ███████╗██║ ██║██║ ██║██║ ███████╗" + ANSI_RESET,
ANSI_CYAN + ANSI_BRIGHT + " ╚════██║██║ ██║██║ ██║██║ ╚════██║" + ANSI_RESET,
ANSI_PURPLE + ANSI_BRIGHT + " ███████║╚██████╔╝╚██████╔╝███████╗███████║" + ANSI_RESET,
ANSI_PURPLE + ANSI_BRIGHT + " ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝" + ANSI_RESET,
"",
ANSI_YELLOW + ANSI_BRIGHT + " ★ Created by DEADLY_XPLAYZ ★ All rights reserved." + ANSI_RESET,
ANSI_CYAN + " Version: " + getDescription().getVersion() + " | Souls: 15 | Lives System Active" + ANSI_RESET,
""
};
for (String line : lines) {
System.out.println(line);
}
}
}