- Restructured everything

This commit is contained in:
2025-09-29 14:21:10 +02:00
parent be602a35e0
commit 35989d9767
80 changed files with 538 additions and 1350 deletions

View File

@@ -1,23 +1,11 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.addon; package dev.unlegitdqrk.unlegitlibrary.addon;
import dev.unlegitdqrk.unlegitlibrary.addon.events.AddonLoadedEvent;
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon; import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
import dev.unlegitdqrk.unlegitlibrary.event.EventListener; import dev.unlegitdqrk.unlegitlibrary.event.EventListener;
import dev.unlegitdqrk.unlegitlibrary.event.EventManager;
import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider; import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider;
import java.io.File; import java.io.File;
@@ -31,13 +19,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.jar.JarFile; import java.util.jar.JarFile;
public class AddonLoader extends DefaultMethodsOverrider { public final class AddonLoader extends DefaultMethodsOverrider {
private final List<Addon> addons; private final List<Addon> addons;
private final Map<String, Class<?>> loadedClasses; private final Map<String, Class<?>> loadedClasses;
private final EventManager eventManager;
public AddonLoader() { public AddonLoader(EventManager eventManager) {
this.addons = new ArrayList<>(); this.addons = new ArrayList<>();
this.loadedClasses = new HashMap<>(); this.loadedClasses = new HashMap<>();
this.eventManager = eventManager;
} }
public final void loadAddonsFromDirectory(File addonFolder) throws IOException { public final void loadAddonsFromDirectory(File addonFolder) throws IOException {
@@ -66,6 +56,7 @@ public class AddonLoader extends DefaultMethodsOverrider {
if (Addon.class.isAssignableFrom(clazz)) { if (Addon.class.isAssignableFrom(clazz)) {
Addon addon = (Addon) clazz.getDeclaredConstructor().newInstance(); Addon addon = (Addon) clazz.getDeclaredConstructor().newInstance();
addons.add(addon); addons.add(addon);
eventManager.executeEvent(new AddonLoadedEvent(addon));
} }
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
@@ -93,12 +84,12 @@ public class AddonLoader extends DefaultMethodsOverrider {
addons.forEach(this::disableAddon); addons.forEach(this::disableAddon);
} }
public final void registerEventListener(Addon addon, EventListener eventListener) throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException { public final void registerEventListener(Addon addon, Class<? extends EventListener> eventListener) throws Exception {
if (!addons.contains(addon)) return; if (!addons.contains(addon)) return;
addon.registerEventListener(eventListener); addon.registerEventListener(eventListener);
} }
public final void unregisterEventListener(Addon addon, EventListener eventListener) { public final void unregisterEventListener(Addon addon, Class<? extends EventListener> eventListener) {
if (!addons.contains(addon)) return; if (!addons.contains(addon)) return;
addon.unregisterEventListener(eventListener); addon.unregisterEventListener(eventListener);
} }

View File

@@ -1,32 +1,22 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.addon.events; package dev.unlegitdqrk.unlegitlibrary.addon.events;
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon; import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
public class AddonDisabledEvent extends Event { public final class AddonDisabledEvent extends Event {
public final Addon addon; private final Addon addon;
public AddonDisabledEvent(Addon addon) { public AddonDisabledEvent(Addon addon) {
this.addon = addon; this.addon = addon;
} }
public Addon getAddon() {
return addon;
}
@Override @Override
protected final Object clone() throws CloneNotSupportedException { protected final Object clone() throws CloneNotSupportedException {
return super.clone(); return super.clone();

View File

@@ -1,32 +1,22 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.addon.events; package dev.unlegitdqrk.unlegitlibrary.addon.events;
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon; import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
public class AddonEnabledEvent extends Event { public final class AddonEnabledEvent extends Event {
public final Addon addon; private final Addon addon;
public AddonEnabledEvent(Addon addon) { public AddonEnabledEvent(Addon addon) {
this.addon = addon; this.addon = addon;
} }
public Addon getAddon() {
return addon;
}
@Override @Override
protected final Object clone() throws CloneNotSupportedException { protected final Object clone() throws CloneNotSupportedException {
return super.clone(); return super.clone();

View File

@@ -0,0 +1,37 @@
package dev.unlegitdqrk.unlegitlibrary.addon.events;
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
public final class AddonLoadedEvent extends Event {
private final Addon addon;
public AddonLoadedEvent(Addon addon) {
this.addon = addon;
}
public Addon getAddon() {
return addon;
}
@Override
protected final Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
@Override
public final String toString() {
return super.toString();
}
@Override
public final int hashCode() {
return super.hashCode();
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.addon.impl; package dev.unlegitdqrk.unlegitlibrary.addon.impl;
@@ -27,12 +13,10 @@ import java.lang.reflect.InvocationTargetException;
public abstract class Addon { public abstract class Addon {
private final AddonInfo addonInfo; private final AddonInfo addonInfo;
private final EventManager eventManager;
private boolean isEnabled = false; private boolean isEnabled = false;
public Addon(AddonInfo addonInfo) { public Addon(AddonInfo addonInfo) {
this.addonInfo = addonInfo; this.addonInfo = addonInfo;
this.eventManager = new EventManager();
} }
public final boolean isEnabled() { public final boolean isEnabled() {
@@ -45,15 +29,15 @@ public abstract class Addon {
public void executeEvent(Event event) { public void executeEvent(Event event) {
if (!isEnabled) return; if (!isEnabled) return;
eventManager.executeEvent(event); addonInfo.getEventManager().executeEvent(event);
} }
public final void registerEventListener(EventListener eventListener) throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException { public final void registerEventListener(Class<? extends EventListener> eventListener) throws Exception {
eventManager.registerListener(eventListener); addonInfo.getEventManager().registerListener(eventListener);
} }
public final void unregisterEventListener(EventListener eventListener) { public final void unregisterEventListener(Class<? extends EventListener> eventListener) {
eventManager.unregisterListener(eventListener); addonInfo.getEventManager().unregisterListener(eventListener);
} }
public abstract void onEnable(); public abstract void onEnable();
@@ -65,7 +49,7 @@ public abstract class Addon {
isEnabled = true; isEnabled = true;
onEnable(); onEnable();
eventManager.executeEvent(new AddonEnabledEvent(this)); addonInfo.getEventManager().executeEvent(new AddonEnabledEvent(this));
} }
public final void disable() { public final void disable() {
@@ -73,6 +57,6 @@ public abstract class Addon {
isEnabled = false; isEnabled = false;
onDisable(); onDisable();
eventManager.executeEvent(new AddonDisabledEvent(this)); addonInfo.getEventManager().executeEvent(new AddonDisabledEvent(this));
} }
} }

View File

@@ -1,31 +1,21 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.addon.impl; package dev.unlegitdqrk.unlegitlibrary.addon.impl;
import dev.unlegitdqrk.unlegitlibrary.event.EventManager;
public class AddonInfo { public class AddonInfo {
private final String name; private final String name;
private final String version; private final String version;
private final String author; private final String author;
private final EventManager eventManager;
public AddonInfo(String name, String version, String author) { public AddonInfo(String name, String version, String author, EventManager eventManager) {
this.name = name; this.name = name;
this.version = version; this.version = version;
this.author = author; this.author = author;
this.eventManager = eventManager;
} }
public final String getAuthor() { public final String getAuthor() {
@@ -40,9 +30,13 @@ public class AddonInfo {
return version; return version;
} }
public final EventManager getEventManager() {
return eventManager;
}
@Override @Override
protected AddonInfo clone() throws CloneNotSupportedException { protected AddonInfo clone() throws CloneNotSupportedException {
return new AddonInfo(name, version, author); return new AddonInfo(name, version, author, eventManager);
} }
@Override @Override

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command; package dev.unlegitdqrk.unlegitlibrary.command;
@@ -22,10 +8,10 @@ import java.util.List;
public abstract class Command { public abstract class Command {
public final CommandManager commandManager; private final CommandManager commandManager;
public final String name; private final String name;
public final String description; private final String description;
public final String usage; private final String usage;
private final List<CommandPermission> permissions; private final List<CommandPermission> permissions;
private final List<String> aliases; private final List<String> aliases;
@@ -42,6 +28,22 @@ public abstract class Command {
if (exists) throw new InstanceAlreadyExistsException("Command with this name or some alias alreadx exists!"); if (exists) throw new InstanceAlreadyExistsException("Command with this name or some alias alreadx exists!");
} }
public final String getName() {
return name;
}
public final CommandManager getCommandManager() {
return commandManager;
}
public final String getDescription() {
return description;
}
public final String getUsage() {
return usage;
}
public final List<CommandPermission> getPermissions() { public final List<CommandPermission> getPermissions() {
return new ArrayList<>(permissions); return new ArrayList<>(permissions);
} }

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command; package dev.unlegitdqrk.unlegitlibrary.command;
@@ -23,7 +9,7 @@ import java.util.List;
public abstract class CommandExecutor { public abstract class CommandExecutor {
public final String name; private final String name;
private final List<CommandPermission> permissions; private final List<CommandPermission> permissions;
public CommandExecutor(String name, CommandPermission... permissions) { public CommandExecutor(String name, CommandPermission... permissions) {
@@ -33,15 +19,19 @@ public abstract class CommandExecutor {
this.permissions.addAll(Arrays.asList(permissions)); this.permissions.addAll(Arrays.asList(permissions));
} }
public List<CommandPermission> getPermissions() { public final String getName() {
return name;
}
public final List<CommandPermission> getPermissions() {
return new ArrayList<>(permissions); return new ArrayList<>(permissions);
} }
public boolean hasPermission(CommandPermission permission) { public final boolean hasPermission(CommandPermission permission) {
return permissions.contains(permission); return permissions.contains(permission);
} }
public boolean hasPermissions(List<CommandPermission> permissions) { public final boolean hasPermissions(List<CommandPermission> permissions) {
return new HashSet<>(this.permissions).containsAll(permissions); return new HashSet<>(this.permissions).containsAll(permissions);
} }

View File

@@ -1,107 +1,94 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command; package dev.unlegitdqrk.unlegitlibrary.command;
import dev.unlegitdqrk.unlegitlibrary.command.events.*; import dev.unlegitdqrk.unlegitlibrary.command.events.*;
import dev.unlegitdqrk.unlegitlibrary.event.EventManager; import dev.unlegitdqrk.unlegitlibrary.event.EventManager;
import java.util.ArrayList; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.*;
import java.util.List;
public class CommandManager { public final class CommandManager {
private final List<Command> commands; private final Map<Class<? extends Command>, Command> commandInstances = new HashMap<>();
private final EventManager eventManager; private final EventManager eventManager;
public CommandManager(EventManager eventManager) { public CommandManager(EventManager eventManager) {
this.commands = new ArrayList<>();
this.eventManager = eventManager; this.eventManager = eventManager;
} }
public final void registerCommand(Command command) { // Registriere die Klasse, instanziiere sie einmalig
if (this.commands.contains(command)) return; public final void registerCommand(Class<? extends Command> commandClass) {
this.commands.add(command); if (commandInstances.containsKey(commandClass)) return;
try {
Command instance = commandClass.getDeclaredConstructor().newInstance();
commandInstances.put(commandClass, instance);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace(); // Oder Logger verwenden
}
} }
public final void unregisterCommand(Command command) { public final void unregisterCommand(Class<? extends Command> commandClass) {
if (!this.commands.contains(command)) return; commandInstances.remove(commandClass);
this.commands.remove(command);
} }
public List<Command> getCommands() { public List<Command> getCommands() {
return new ArrayList<>(commands); return new ArrayList<>(commandInstances.values());
} }
public Command getCommandByName(String name) { public Command getCommandByName(String name) {
for (Command command : commands) if (command.name.equals(name)) return command; for (Command cmd : commandInstances.values()) {
return null; if (cmd.getName().equalsIgnoreCase(name)) return cmd;
}
public Command getCommandByAliases(List<String> aliases) {
for (String alias : aliases) {
for (Command command : commands) {
List<String> aliasesCommand = new ArrayList<>();
for (String registeredAlias : command.getAliases()) aliasesCommand.add(registeredAlias.toLowerCase());
if (aliasesCommand.contains(alias.toLowerCase())) return command;
}
} }
return null; return null;
} }
public Command getCommandByAlias(String alias) { public Command getCommandByAlias(String alias) {
for (Command command : commands) { for (Command cmd : commandInstances.values()) {
List<String> aliasesCommand = new ArrayList<>(); for (String a : cmd.getAliases()) {
for (String registeredAlias : command.getAliases()) aliasesCommand.add(registeredAlias.toLowerCase()); if (a.equalsIgnoreCase(alias)) return cmd;
if (aliasesCommand.contains(alias.toLowerCase())) return command; }
} }
return null; return null;
} }
public Command getCommand(String input) { public Command getCommand(String input) {
if (getCommandByName(input) != null) return getCommandByName(input); Command cmd = getCommandByName(input);
if (getCommandByAlias(input) != null) return getCommandByAlias(input); return (cmd != null) ? cmd : getCommandByAlias(input);
return null;
} }
public void execute(CommandExecutor commandExecutor, String line) { public void execute(CommandExecutor executor, String line) {
String[] split = line.split(" "); String[] split = line.trim().split("\\s+");
String command = split[0]; if (split.length == 0) return;
String commandLabel = split[0];
String[] args = Arrays.copyOfRange(split, 1, split.length); String[] args = Arrays.copyOfRange(split, 1, split.length);
if (getCommand(command) != null) { Command command = getCommand(commandLabel);
Command cmd = getCommand(command); if (command == null) {
PreCommandExecuteEvent preEvent = new PreCommandExecuteEvent(this, commandExecutor, cmd); eventManager.executeEvent(new CommandNotFoundEvent(this, executor, commandLabel, args));
eventManager.executeEvent(preEvent); return;
}
if (preEvent.isCancelled()) return; // Pre-execute event
PreCommandExecuteEvent preEvent = new PreCommandExecuteEvent(this, executor, command);
eventManager.executeEvent(preEvent);
if (preEvent.isCancelled()) return;
if (commandExecutor.hasPermissions(cmd.getPermissions())) { // Check permissions
CommandExecuteEvent event = new CommandExecuteEvent(this, commandExecutor, cmd); if (!executor.hasPermissions(command.getPermissions())) {
eventManager.executeEvent(event); eventManager.executeEvent(new CommandExecutorMissingPermissionEvent(this, executor, command));
return;
}
if (event.isCancelled()) return; // Execute event
CommandExecuteEvent execEvent = new CommandExecuteEvent(this, executor, command);
eventManager.executeEvent(execEvent);
if (execEvent.isCancelled()) return;
cmd.execute(commandExecutor, command, args); // Execute command
eventManager.executeEvent(new CommandExecutedEvent(this, commandExecutor, cmd)); command.execute(executor, commandLabel, args);
} else eventManager.executeEvent(new CommandExecutorMissingPermissionEvent(this, commandExecutor, cmd));
} else eventManager.executeEvent(new CommandNotFoundEvent(this, commandExecutor, command, args)); // Post-execute event
eventManager.executeEvent(new CommandExecutedEvent(this, executor, command));
} }
} }

View File

@@ -1,28 +1,7 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command; package dev.unlegitdqrk.unlegitlibrary.command;
public class CommandPermission { public final record CommandPermission(String name, int level) {
public final String name;
public final int level;
public CommandPermission(String name, int level) {
this.name = name;
this.level = level;
}
} }

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command.events; package dev.unlegitdqrk.unlegitlibrary.command.events;
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager; import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
import dev.unlegitdqrk.unlegitlibrary.event.impl.CancellableEvent; import dev.unlegitdqrk.unlegitlibrary.event.impl.CancellableEvent;
public class CommandExecuteEvent extends CancellableEvent { public final class CommandExecuteEvent extends CancellableEvent {
public final CommandManager commandManager; private final CommandManager commandManager;
public final CommandExecutor commandExecutor; private final CommandExecutor commandExecutor;
public final Command command; private final Command command;
public CommandManager getCommandManager() {
return commandManager;
}
public CommandExecutor getCommandExecutor() {
return commandExecutor;
}
public Command getCommand() {
return command;
}
public CommandExecuteEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) { public CommandExecuteEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) {
this.commandManager = commandManager; this.commandManager = commandManager;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command.events; package dev.unlegitdqrk.unlegitlibrary.command.events;
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager; import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
public class CommandExecutedEvent extends Event { public final class CommandExecutedEvent extends Event {
public final CommandManager commandManager; private final CommandManager commandManager;
public final CommandExecutor commandExecutor; private final CommandExecutor commandExecutor;
public final Command command; private final Command command;
public CommandExecutor getCommandExecutor() {
return commandExecutor;
}
public CommandManager getCommandManager() {
return commandManager;
}
public Command getCommand() {
return command;
}
public CommandExecutedEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) { public CommandExecutedEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) {
this.commandManager = commandManager; this.commandManager = commandManager;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command.events; package dev.unlegitdqrk.unlegitlibrary.command.events;
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager; import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
public class CommandExecutorMissingPermissionEvent extends Event { public final class CommandExecutorMissingPermissionEvent extends Event {
public final CommandManager commandManager; private final CommandManager commandManager;
public final CommandExecutor commandExecutor; private final CommandExecutor commandExecutor;
public final Command command; private final Command command;
public CommandManager getCommandManager() {
return commandManager;
}
public Command getCommand() {
return command;
}
public CommandExecutor getCommandExecutor() {
return commandExecutor;
}
public CommandExecutorMissingPermissionEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) { public CommandExecutorMissingPermissionEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) {
this.commandManager = commandManager; this.commandManager = commandManager;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command.events; package dev.unlegitdqrk.unlegitlibrary.command.events;
@@ -20,11 +6,27 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager; import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
public class CommandNotFoundEvent extends Event { public final class CommandNotFoundEvent extends Event {
public final CommandManager commandManager; private final CommandManager commandManager;
public final CommandExecutor commandExecutor; private final CommandExecutor commandExecutor;
public final String name; private final String name;
public final String[] args; private final String[] args;
public CommandManager getCommandManager() {
return commandManager;
}
public CommandExecutor getCommandExecutor() {
return commandExecutor;
}
public String getName() {
return name;
}
public String[] getArgs() {
return args;
}
public CommandNotFoundEvent(CommandManager commandManager, CommandExecutor commandExecutor, String name, String[] args) { public CommandNotFoundEvent(CommandManager commandManager, CommandExecutor commandExecutor, String name, String[] args) {
this.commandManager = commandManager; this.commandManager = commandManager;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.command.events; package dev.unlegitdqrk.unlegitlibrary.command.events;
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager; import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
import dev.unlegitdqrk.unlegitlibrary.event.impl.CancellableEvent; import dev.unlegitdqrk.unlegitlibrary.event.impl.CancellableEvent;
public class PreCommandExecuteEvent extends CancellableEvent { public final class PreCommandExecuteEvent extends CancellableEvent {
public final CommandManager commandManager; private final CommandManager commandManager;
public final CommandExecutor commandExecutor; private final CommandExecutor commandExecutor;
public final Command command; private final Command command;
public Command getCommand() {
return command;
}
public CommandExecutor getCommandExecutor() {
return commandExecutor;
}
public CommandManager getCommandManager() {
return commandManager;
}
public PreCommandExecuteEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) { public PreCommandExecuteEvent(CommandManager commandManager, CommandExecutor commandExecutor, Command command) {
this.commandManager = commandManager; this.commandManager = commandManager;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.event; package dev.unlegitdqrk.unlegitlibrary.event;

View File

@@ -1,19 +1,3 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.event; package dev.unlegitdqrk.unlegitlibrary.event;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
@@ -21,141 +5,78 @@ import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class EventManager extends DefaultMethodsOverrider { public final class EventManager extends DefaultMethodsOverrider {
private final HashMap<Class<? extends Event>, HashMap<EventPriority, HashMap<Object, Method>>> registeredListener = new HashMap<>(); private final Map<Class<? extends Event>, Map<EventPriority, Map<Object, Method>>> registeredListener = new HashMap<>();
private final HashMap<EventListener, Object> eventListeners = new HashMap<>(); private final Map<Class<? extends EventListener>, Object> eventListeners = new HashMap<>();
public final void registerListener(EventListener listenerClass) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { public final void registerListener(Class<? extends EventListener> listenerClass) throws Exception {
if (isListenerRegistered(listenerClass)) return; if (isListenerRegistered(listenerClass)) return;
for (Method method : listenerClass.getClass().getDeclaredMethods()) { Object instance = listenerClass.getDeclaredConstructor().newInstance();
Listener listener = method.getAnnotation(Listener.class);
if (listener == null) continue; for (Method method : listenerClass.getDeclaredMethods()) {
Listener listenerAnnotation = method.getAnnotation(Listener.class);
if (method.getParameterCount() == 1) { if (listenerAnnotation == null || method.getParameterCount() != 1) continue;
Class<? extends Event> eventClass = (Class<? extends Event>) method.getParameterTypes()[0];
HashMap<EventPriority, HashMap<Object, Method>> list = registeredListener.getOrDefault(eventClass, new HashMap<>()); Class<?> paramType = method.getParameterTypes()[0];
HashMap<Object, Method> set = list.getOrDefault(listener.priority(), new HashMap<>()); if (!Event.class.isAssignableFrom(paramType)) continue;
set.put(listenerClass, method); @SuppressWarnings("unchecked")
list.put(listener.priority(), set); Class<? extends Event> eventClass = (Class<? extends Event>) paramType;
registeredListener.put(eventClass, list);
} registeredListener
.computeIfAbsent(eventClass, k -> new EnumMap<>(EventPriority.class))
.computeIfAbsent(listenerAnnotation.priority(), k -> new HashMap<>())
.put(instance, method);
} }
eventListeners.put(listenerClass, listenerClass); eventListeners.put(listenerClass, instance);
} }
public synchronized final void unregisterListener(EventListener listenerClass) { public synchronized final void unregisterListener(Class<? extends EventListener> listenerClass) {
if (!isListenerRegistered(listenerClass)) return; if (!isListenerRegistered(listenerClass)) return;
Object clazz = eventListeners.get(listenerClass); Object instance = eventListeners.get(listenerClass);
synchronized (registeredListener) { for (Map<EventPriority, Map<Object, Method>> priorityMap : registeredListener.values()) {
List<Class<? extends Event>> eventsToRemove = new ArrayList<>(); for (Map<Object, Method> listeners : priorityMap.values()) {
listeners.remove(instance);
for (Map.Entry<Class<? extends Event>, HashMap<EventPriority, HashMap<Object, Method>>> entry : registeredListener.entrySet()) {
Class<? extends Event> eventClass = entry.getKey();
HashMap<EventPriority, HashMap<Object, Method>> priorityMap = entry.getValue();
if (priorityMap != null) {
synchronized (priorityMap) {
List<EventPriority> prioritiesToRemove = new ArrayList<>();
for (Map.Entry<EventPriority, HashMap<Object, Method>> priorityEntry : priorityMap.entrySet()) {
EventPriority priority = priorityEntry.getKey();
HashMap<Object, Method> listeners = priorityEntry.getValue();
if (listeners != null) {
listeners.remove(clazz);
if (listeners.isEmpty()) {
prioritiesToRemove.add(priority);
}
}
}
for (EventPriority priority : prioritiesToRemove) {
priorityMap.remove(priority);
}
if (priorityMap.isEmpty()) {
eventsToRemove.add(eventClass);
}
}
}
}
for (Class<? extends Event> eventClass : eventsToRemove) {
registeredListener.remove(eventClass);
} }
} }
// Clean up empty entries
registeredListener.entrySet().removeIf(e ->
e.getValue().values().stream().allMatch(Map::isEmpty));
eventListeners.remove(listenerClass); eventListeners.remove(listenerClass);
} }
public final boolean isListenerRegistered(EventListener listenerClass) { public final boolean isListenerRegistered(Class<? extends EventListener> listenerClass) {
return eventListeners.containsKey(listenerClass); return eventListeners.containsKey(listenerClass);
} }
public final void executeEvent(Event event) { public final void executeEvent(Event event) {
HashMap<EventPriority, HashMap<Object, Method>> list = registeredListener.getOrDefault(event.getClass(), new HashMap<>()); Map<EventPriority, Map<Object, Method>> listenersByPriority = registeredListener.get(event.getClass());
if (listenersByPriority == null) return;
list.getOrDefault(EventPriority.LOWEST, new HashMap<>()).forEach((k, v) -> { for (EventPriority priority : EventPriority.values()) {
if (!isListenerRegistered((EventListener) k)) return; Map<Object, Method> listeners = listenersByPriority.getOrDefault(priority, Collections.emptyMap());
try { for (Map.Entry<Object, Method> entry : listeners.entrySet()) {
v.invoke(k, event); Object instance = entry.getKey();
} catch (IllegalAccessException | InvocationTargetException exception) { Method method = entry.getValue();
exception.printStackTrace();
try {
method.setAccessible(true);
method.invoke(instance, event);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
} }
}); }
list.getOrDefault(EventPriority.LOW, new HashMap<>()).forEach((k, v) -> {
if (!isListenerRegistered((EventListener) k)) return;
try {
v.invoke(k, event);
} catch (IllegalAccessException | InvocationTargetException exception) {
exception.printStackTrace();
}
});
list.getOrDefault(EventPriority.NORMAL, new HashMap<>()).forEach((k, v) -> {
if (!isListenerRegistered((EventListener) k)) return;
try {
v.invoke(k, event);
} catch (IllegalAccessException | InvocationTargetException exception) {
exception.printStackTrace();
}
});
list.getOrDefault(EventPriority.HIGH, new HashMap<>()).forEach((k, v) -> {
if (!isListenerRegistered((EventListener) k)) return;
try {
v.invoke(k, event);
} catch (IllegalAccessException | InvocationTargetException exception) {
exception.printStackTrace();
}
});
list.getOrDefault(EventPriority.HIGHEST, new HashMap<>()).forEach((k, v) -> {
if (!isListenerRegistered((EventListener) k)) return;
try {
v.invoke(k, event);
} catch (IllegalAccessException | InvocationTargetException exception) {
exception.printStackTrace();
}
});
} }
} }

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.event; package dev.unlegitdqrk.unlegitlibrary.event;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.event; package dev.unlegitdqrk.unlegitlibrary.event;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.event.impl; package dev.unlegitdqrk.unlegitlibrary.event.impl;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.event.impl; package dev.unlegitdqrk.unlegitlibrary.event.impl;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.file; package dev.unlegitdqrk.unlegitlibrary.file;
@@ -22,7 +8,7 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
public class ClassDefiner extends DefaultMethodsOverrider { public final class ClassDefiner extends DefaultMethodsOverrider {
private static final Map<ClassLoader, ClassDefinerLoader> loaders = Collections.synchronizedMap(new WeakHashMap<>()); private static final Map<ClassLoader, ClassDefinerLoader> loaders = Collections.synchronizedMap(new WeakHashMap<>());

View File

@@ -1,10 +1,3 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.file; package dev.unlegitdqrk.unlegitlibrary.file;
@@ -17,7 +10,7 @@ import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ConfigurationManager extends DefaultMethodsOverrider { public final class ConfigurationManager extends DefaultMethodsOverrider {
private final Properties properties = new Properties(); private final Properties properties = new Properties();
private final File configFile; private final File configFile;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.file; package dev.unlegitdqrk.unlegitlibrary.file;
@@ -31,7 +17,7 @@ import java.util.stream.Stream;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
public class FileUtils extends DefaultMethodsOverrider { public final class FileUtils extends DefaultMethodsOverrider {
public static String getSuffix(File file) { public static String getSuffix(File file) {
String[] splitName = file.getName().split("\\."); String[] splitName = file.getName().split("\\.");

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.file; package dev.unlegitdqrk.unlegitlibrary.file;
@@ -23,7 +9,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Arrays; import java.util.Arrays;
public class ReflectUtils extends DefaultMethodsOverrider { public final class ReflectUtils extends DefaultMethodsOverrider {
public static Method getMethodByArgs(final Class<?> clazz, final Class<?>... args) { public static Method getMethodByArgs(final Class<?> clazz, final Class<?>... args) {
for (Method method : clazz.getDeclaredMethods()) for (Method method : clazz.getDeclaredMethods())

View File

@@ -1,10 +1,3 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client; package dev.unlegitdqrk.unlegitlibrary.network.system.client;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
public class C_PacketReceivedEvent extends Event { public final class C_PacketReceivedEvent extends Event {
public final NetworkClient networkClient; private final NetworkClient networkClient;
public final Packet packet; private final Packet packet;
public NetworkClient getNetworkClient() {
return networkClient;
}
public Packet getPacket() {
return packet;
}
public C_PacketReceivedEvent(NetworkClient networkClient, Packet packet) { public C_PacketReceivedEvent(NetworkClient networkClient, Packet packet) {
this.networkClient = networkClient; this.networkClient = networkClient;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
public class C_PacketReceivedFailedEvent extends Event { public final class C_PacketReceivedFailedEvent extends Event {
public final NetworkClient networkClient; private final NetworkClient networkClient;
public final Packet packet; private final Packet packet;
public NetworkClient getNetworkClient() {
return networkClient;
}
public Packet getPacket() {
return packet;
}
public C_PacketReceivedFailedEvent(NetworkClient networkClient, Packet packet) { public C_PacketReceivedFailedEvent(NetworkClient networkClient, Packet packet) {
this.networkClient = networkClient; this.networkClient = networkClient;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
public class C_PacketSendEvent extends Event { public final class C_PacketSendEvent extends Event {
public final NetworkClient networkClient; private final NetworkClient networkClient;
public final Packet packet; private final Packet packet;
public NetworkClient getNetworkClient() {
return networkClient;
}
public Packet getPacket() {
return packet;
}
public C_PacketSendEvent(NetworkClient networkClient, Packet packet) { public C_PacketSendEvent(NetworkClient networkClient, Packet packet) {
this.networkClient = networkClient; this.networkClient = networkClient;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
@@ -20,9 +6,18 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
public class C_PacketSendFailedEvent extends Event { public final class C_PacketSendFailedEvent extends Event {
public final NetworkClient networkClient; private final NetworkClient networkClient;
public final Packet packet; private final Packet packet;
public NetworkClient getNetworkClient() {
return networkClient;
}
public Packet getPacket() {
return packet;
}
public C_PacketSendFailedEvent(NetworkClient networkClient, Packet packet) { public C_PacketSendFailedEvent(NetworkClient networkClient, Packet packet) {
this.networkClient = networkClient; this.networkClient = networkClient;

View File

@@ -1,27 +1,21 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
public class C_UnknownObjectReceivedEvent extends Event { public final class C_UnknownObjectReceivedEvent extends Event {
public final NetworkClient networkClient; private final NetworkClient networkClient;
public final Object received; private final Object received;
public NetworkClient getNetworkClient() {
return networkClient;
}
public Object getReceived() {
return received;
}
public C_UnknownObjectReceivedEvent(NetworkClient networkClient, Object received) { public C_UnknownObjectReceivedEvent(NetworkClient networkClient, Object received) {
this.networkClient = networkClient; this.networkClient = networkClient;

View File

@@ -1,26 +1,17 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
public class ClientConnectedEvent extends Event { public final class ClientConnectedEvent extends Event {
public final NetworkClient client; private final NetworkClient client;
public NetworkClient getClient() {
return client;
}
public ClientConnectedEvent(NetworkClient client) { public ClientConnectedEvent(NetworkClient client) {
this.client = client; this.client = client;

View File

@@ -1,26 +1,16 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.client.events; package dev.unlegitdqrk.unlegitlibrary.network.system.client.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient; import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
public class ClientDisconnectedEvent extends Event { public final class ClientDisconnectedEvent extends Event {
public final NetworkClient client; private final NetworkClient client;
public NetworkClient getClient() {
return client;
}
public ClientDisconnectedEvent(NetworkClient client) { public ClientDisconnectedEvent(NetworkClient client) {
this.client = client; this.client = client;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.packets; package dev.unlegitdqrk.unlegitlibrary.network.system.packets;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.packets; package dev.unlegitdqrk.unlegitlibrary.network.system.packets;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.packets.impl; package dev.unlegitdqrk.unlegitlibrary.network.system.packets.impl;
@@ -23,7 +9,7 @@ import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
public class ClientIDPacket extends Packet { public final class ClientIDPacket extends Packet {
private int clientID; private int clientID;
public ClientIDPacket() { public ClientIDPacket() {

View File

@@ -1,10 +1,3 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server; package dev.unlegitdqrk.unlegitlibrary.network.system.server;
@@ -18,7 +11,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.net.SocketException; import java.net.SocketException;
public class ConnectionHandler { public final class ConnectionHandler {
private SSLSocket socket; private SSLSocket socket;
private int clientID; private int clientID;
private ObjectOutputStream outputStream; private ObjectOutputStream outputStream;
@@ -31,19 +24,19 @@ public class ConnectionHandler {
return target.getClientID() == clientID; return target.getClientID() == clientID;
} }
public SSLSocket getSocket() { public final SSLSocket getSocket() {
return socket; return socket;
} }
public ObjectOutputStream getOutputStream() { public final ObjectOutputStream getOutputStream() {
return outputStream; return outputStream;
} }
public ObjectInputStream getInputStream() { public final ObjectInputStream getInputStream() {
return inputStream; return inputStream;
} }
public NetworkServer getServer() { public final NetworkServer getServer() {
return server; return server;
} }

View File

@@ -1,10 +1,3 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server; package dev.unlegitdqrk.unlegitlibrary.network.system.server;
@@ -36,7 +29,7 @@ public final class NetworkServer {
private final List<ConnectionHandler> connectionHandlers = new ArrayList<>(); private final List<ConnectionHandler> connectionHandlers = new ArrayList<>();
private final Thread incomingThread = new Thread(this::incomingConnections); private final Thread incomingThread = new Thread(this::incomingConnections);
public List<ConnectionHandler> getConnectionHandlers() { public final List<ConnectionHandler> getConnectionHandlers() {
return connectionHandlers; return connectionHandlers;
} }
@@ -51,7 +44,7 @@ public final class NetworkServer {
return super.equals(obj); return super.equals(obj);
} }
public int getPort() { public final int getPort() {
return port; return port;
} }

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -20,7 +6,11 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public final class ConnectionHandlerConnectedEvent extends Event { public final class ConnectionHandlerConnectedEvent extends Event {
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public ConnectionHandlerConnectedEvent(ConnectionHandler connectionHandler) { public ConnectionHandlerConnectedEvent(ConnectionHandler connectionHandler) {
this.connectionHandler = connectionHandler; this.connectionHandler = connectionHandler;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -20,7 +6,12 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public final class ConnectionHandlerDisconnectedEvent extends Event { public final class ConnectionHandlerDisconnectedEvent extends Event {
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public ConnectionHandlerDisconnectedEvent(ConnectionHandler connectionHandler) { public ConnectionHandlerDisconnectedEvent(ConnectionHandler connectionHandler) {
this.connectionHandler = connectionHandler; this.connectionHandler = connectionHandler;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -21,9 +7,17 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.server.NetworkServer;
import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket;
public class IncomingConnectionEvent extends CancellableEvent { public final class IncomingConnectionEvent extends CancellableEvent {
public final NetworkServer server; private final NetworkServer server;
public final SSLSocket socket; private final SSLSocket socket;
public SSLSocket getSocket() {
return socket;
}
public NetworkServer getServer() {
return server;
}
public IncomingConnectionEvent(NetworkServer server, SSLSocket socket) { public IncomingConnectionEvent(NetworkServer server, SSLSocket socket) {
this.server = server; this.server = server;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public class S_PacketReceivedEvent extends Event { public final class S_PacketReceivedEvent extends Event {
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public final Packet packet; private final Packet packet;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public Packet getPacket() {
return packet;
}
public S_PacketReceivedEvent(ConnectionHandler connectionHandler, Packet packet) { public S_PacketReceivedEvent(ConnectionHandler connectionHandler, Packet packet) {
this.connectionHandler = connectionHandler; this.connectionHandler = connectionHandler;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public class S_PacketReceivedFailedEvent extends Event { public final class S_PacketReceivedFailedEvent extends Event {
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public final Packet packet; private final Packet packet;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public Packet getPacket() {
return packet;
}
public S_PacketReceivedFailedEvent(ConnectionHandler connectionHandler, Packet packet) { public S_PacketReceivedFailedEvent(ConnectionHandler connectionHandler, Packet packet) {
this.connectionHandler = connectionHandler; this.connectionHandler = connectionHandler;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public class S_PacketSendEvent extends Event { public final class S_PacketSendEvent extends Event {
public final Packet packet; private final Packet packet;
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public Packet getPacket() {
return packet;
}
public S_PacketSendEvent(Packet packet, ConnectionHandler connectionHandler) { public S_PacketSendEvent(Packet packet, ConnectionHandler connectionHandler) {
this.packet = packet; this.packet = packet;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
@@ -20,9 +6,17 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet; import dev.unlegitdqrk.unlegitlibrary.network.system.packets.Packet;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public class S_PacketSendFailedEvent extends Event { public final class S_PacketSendFailedEvent extends Event {
public final Packet packet; private final Packet packet;
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public Packet getPacket() {
return packet;
}
public S_PacketSendFailedEvent(Packet packet, ConnectionHandler connectionHandler) { public S_PacketSendFailedEvent(Packet packet, ConnectionHandler connectionHandler) {
this.packet = packet; this.packet = packet;

View File

@@ -1,28 +1,22 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.system.server.events; package dev.unlegitdqrk.unlegitlibrary.network.system.server.events;
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event; import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler; import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
public class S_UnknownObjectReceivedEvent extends Event { public final class S_UnknownObjectReceivedEvent extends Event {
public final Object received; private final Object received;
public final ConnectionHandler connectionHandler; private final ConnectionHandler connectionHandler;
public ConnectionHandler getConnectionHandler() {
return connectionHandler;
}
public Object getReceived() {
return received;
}
public S_UnknownObjectReceivedEvent(Object received, ConnectionHandler connectionHandler) { public S_UnknownObjectReceivedEvent(Object received, ConnectionHandler connectionHandler) {
this.received = received; this.received = received;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.utils; package dev.unlegitdqrk.unlegitlibrary.network.utils;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.utils; package dev.unlegitdqrk.unlegitlibrary.network.utils;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.utils; package dev.unlegitdqrk.unlegitlibrary.network.utils;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.network.utils; package dev.unlegitdqrk.unlegitlibrary.network.utils;

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number;
public enum Axis {
X, Y, Z
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number; package dev.unlegitdqrk.unlegitlibrary.number;

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number;
import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider;
public class Modulo extends DefaultMethodsOverrider {
public static int calculate(int number, int dividedBy) {
return number % dividedBy;
}
public static float calculate(float number, float dividedBy) {
return number % dividedBy;
}
public static double calculate(double number, double dividedBy) {
return number % dividedBy;
}
public static long calculate(long number, long dividedBy) {
return number % dividedBy;
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number; package dev.unlegitdqrk.unlegitlibrary.number;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number; package dev.unlegitdqrk.unlegitlibrary.number;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number; package dev.unlegitdqrk.unlegitlibrary.number;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.bit; package dev.unlegitdqrk.unlegitlibrary.number.bit;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.bit; package dev.unlegitdqrk.unlegitlibrary.number.bit;

View File

@@ -1,22 +1,8 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.bit; package dev.unlegitdqrk.unlegitlibrary.number.bit;
import dev.unlegitdqrk.unlegitlibrary.number.MathHelper; import dev.unlegitdqrk.unlegitlibrary.number.math.MathHelper;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.bit; package dev.unlegitdqrk.unlegitlibrary.number.bit;

View File

@@ -1,20 +1,8 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number;
package dev.unlegitdqrk.unlegitlibrary.number.math;
import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider; import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider;

View File

@@ -0,0 +1,27 @@
package dev.unlegitdqrk.unlegitlibrary.number.math;
import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider;
public class Modulo extends DefaultMethodsOverrider {
public static int calculate(int number, int dividedBy) {
return number % dividedBy;
}
public static float calculate(float number, float dividedBy) {
return number % dividedBy;
}
public static double calculate(double number, double dividedBy) {
return number % dividedBy;
}
public static long calculate(long number, long dividedBy) {
return number % dividedBy;
}
}

View File

@@ -1,23 +1,11 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number;
import dev.unlegitdqrk.unlegitlibrary.number.vector.Vector2;
import dev.unlegitdqrk.unlegitlibrary.number.vector.Vector3; package dev.unlegitdqrk.unlegitlibrary.number.math;
import dev.unlegitdqrk.unlegitlibrary.number.math.vector.Vector2;
import dev.unlegitdqrk.unlegitlibrary.number.math.vector.Vector3;
public class Quaternion { public class Quaternion {

View File

@@ -0,0 +1,15 @@
package dev.unlegitdqrk.unlegitlibrary.number.math.molecular;
public class MolecularAdd {
/**
* @param k is the start number
* @param n is the end number
**/
public static int useFormula(int k, int n) {
return ((n - k + 1) * (n + k)) / 2;
}
}

View File

@@ -0,0 +1,18 @@
package dev.unlegitdqrk.unlegitlibrary.number.math.molecular;
import dev.unlegitdqrk.unlegitlibrary.number.math.MathHelper;
public class MolecularSubtract {
/**
* @param k is the start number
* @param n is the end number
**/
public static int useFormula(int k, int n) {
if (!MathHelper.isNegative(n)) n = -(n);
return ((-n - k + 1) * (-n + k) / 2) + k;
}
}

View File

@@ -0,0 +1,9 @@
package dev.unlegitdqrk.unlegitlibrary.number.math.vector;
public enum Axis {
X, Y, Z
}

View File

@@ -1,20 +1,6 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.vector; package dev.unlegitdqrk.unlegitlibrary.number.math.vector;
public class Vector2 { public class Vector2 {

View File

@@ -1,22 +1,8 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.vector; package dev.unlegitdqrk.unlegitlibrary.number.math.vector;
import dev.unlegitdqrk.unlegitlibrary.number.Quaternion; import dev.unlegitdqrk.unlegitlibrary.number.math.Quaternion;
public class Vector3 { public class Vector3 {
public float x; public float x;

View File

@@ -1,29 +0,0 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.molecular;
public class MolecularAdd {
/**
* @param k is the start number
* @param n is the end number
**/
public static int useFormula(int k, int n) {
return ((n - k + 1) * (n + k)) / 2;
}
}

View File

@@ -1,32 +0,0 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.number.molecular;
import dev.unlegitdqrk.unlegitlibrary.number.MathHelper;
public class MolecularSubtract {
/**
* @param k is the start number
* @param n is the end number
**/
public static int useFormula(int k, int n) {
if (!MathHelper.isNegative(n)) n = -(n);
return ((-n - k + 1) * (-n + k) / 2) + k;
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.string; package dev.unlegitdqrk.unlegitlibrary.string;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.string; package dev.unlegitdqrk.unlegitlibrary.string;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.string; package dev.unlegitdqrk.unlegitlibrary.string;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.string.color; package dev.unlegitdqrk.unlegitlibrary.string.color;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.string.color; package dev.unlegitdqrk.unlegitlibrary.string.color;

View File

@@ -1,14 +1,7 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.utils; package dev.unlegitdqrk.unlegitlibrary.utils;
import dev.unlegitdqrk.unlegitlibrary.number.MathHelper; import dev.unlegitdqrk.unlegitlibrary.number.math.MathHelper;
public class Color { public class Color {

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.utils; package dev.unlegitdqrk.unlegitlibrary.utils;

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.utils; package dev.unlegitdqrk.unlegitlibrary.utils;

View File

@@ -1,10 +1,3 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.utils; package dev.unlegitdqrk.unlegitlibrary.utils;
@@ -210,4 +203,16 @@ public final class Logger {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
public final boolean isInitialized() {
return isInitialized;
}
public final File getLatestLogFile() {
return latestLogFile;
}
public final File getLogFolder() {
return logFolder;
}
} }

View File

@@ -1,18 +1,4 @@
/*
* Copyright (C) 2025 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
/*
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
*
* You are unauthorized to remove this copyright.
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
* See LICENSE-File if exists
*/
package dev.unlegitdqrk.unlegitlibrary.utils; package dev.unlegitdqrk.unlegitlibrary.utils;