- Restructured everything
This commit is contained in:
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.addon.events.AddonLoadedEvent;
|
||||
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.EventListener;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.EventManager;
|
||||
import dev.unlegitdqrk.unlegitlibrary.utils.DefaultMethodsOverrider;
|
||||
|
||||
import java.io.File;
|
||||
@@ -31,13 +19,15 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class AddonLoader extends DefaultMethodsOverrider {
|
||||
public final class AddonLoader extends DefaultMethodsOverrider {
|
||||
private final List<Addon> addons;
|
||||
private final Map<String, Class<?>> loadedClasses;
|
||||
private final EventManager eventManager;
|
||||
|
||||
public AddonLoader() {
|
||||
public AddonLoader(EventManager eventManager) {
|
||||
this.addons = new ArrayList<>();
|
||||
this.loadedClasses = new HashMap<>();
|
||||
this.eventManager = eventManager;
|
||||
}
|
||||
|
||||
public final void loadAddonsFromDirectory(File addonFolder) throws IOException {
|
||||
@@ -66,6 +56,7 @@ public class AddonLoader extends DefaultMethodsOverrider {
|
||||
if (Addon.class.isAssignableFrom(clazz)) {
|
||||
Addon addon = (Addon) clazz.getDeclaredConstructor().newInstance();
|
||||
addons.add(addon);
|
||||
eventManager.executeEvent(new AddonLoadedEvent(addon));
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
@@ -93,12 +84,12 @@ public class AddonLoader extends DefaultMethodsOverrider {
|
||||
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;
|
||||
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;
|
||||
addon.unregisterEventListener(eventListener);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
|
||||
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) {
|
||||
this.addon = addon;
|
||||
}
|
||||
|
||||
public Addon getAddon() {
|
||||
return addon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.addon.impl.Addon;
|
||||
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) {
|
||||
this.addon = addon;
|
||||
}
|
||||
|
||||
public Addon getAddon() {
|
||||
return addon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
||||
@@ -27,12 +13,10 @@ import java.lang.reflect.InvocationTargetException;
|
||||
public abstract class Addon {
|
||||
|
||||
private final AddonInfo addonInfo;
|
||||
private final EventManager eventManager;
|
||||
private boolean isEnabled = false;
|
||||
|
||||
public Addon(AddonInfo addonInfo) {
|
||||
this.addonInfo = addonInfo;
|
||||
this.eventManager = new EventManager();
|
||||
}
|
||||
|
||||
public final boolean isEnabled() {
|
||||
@@ -45,15 +29,15 @@ public abstract class Addon {
|
||||
|
||||
public void executeEvent(Event event) {
|
||||
if (!isEnabled) return;
|
||||
eventManager.executeEvent(event);
|
||||
addonInfo.getEventManager().executeEvent(event);
|
||||
}
|
||||
|
||||
public final void registerEventListener(EventListener eventListener) throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {
|
||||
eventManager.registerListener(eventListener);
|
||||
public final void registerEventListener(Class<? extends EventListener> eventListener) throws Exception {
|
||||
addonInfo.getEventManager().registerListener(eventListener);
|
||||
}
|
||||
|
||||
public final void unregisterEventListener(EventListener eventListener) {
|
||||
eventManager.unregisterListener(eventListener);
|
||||
public final void unregisterEventListener(Class<? extends EventListener> eventListener) {
|
||||
addonInfo.getEventManager().unregisterListener(eventListener);
|
||||
}
|
||||
|
||||
public abstract void onEnable();
|
||||
@@ -65,7 +49,7 @@ public abstract class Addon {
|
||||
|
||||
isEnabled = true;
|
||||
onEnable();
|
||||
eventManager.executeEvent(new AddonEnabledEvent(this));
|
||||
addonInfo.getEventManager().executeEvent(new AddonEnabledEvent(this));
|
||||
}
|
||||
|
||||
public final void disable() {
|
||||
@@ -73,6 +57,6 @@ public abstract class Addon {
|
||||
|
||||
isEnabled = false;
|
||||
onDisable();
|
||||
eventManager.executeEvent(new AddonDisabledEvent(this));
|
||||
addonInfo.getEventManager().executeEvent(new AddonDisabledEvent(this));
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.EventManager;
|
||||
|
||||
public class AddonInfo {
|
||||
|
||||
private final String name;
|
||||
private final String version;
|
||||
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.version = version;
|
||||
this.author = author;
|
||||
this.eventManager = eventManager;
|
||||
}
|
||||
|
||||
public final String getAuthor() {
|
||||
@@ -40,9 +30,13 @@ public class AddonInfo {
|
||||
return version;
|
||||
}
|
||||
|
||||
public final EventManager getEventManager() {
|
||||
return eventManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AddonInfo clone() throws CloneNotSupportedException {
|
||||
return new AddonInfo(name, version, author);
|
||||
return new AddonInfo(name, version, author, eventManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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;
|
||||
|
||||
@@ -22,10 +8,10 @@ import java.util.List;
|
||||
|
||||
public abstract class Command {
|
||||
|
||||
public final CommandManager commandManager;
|
||||
public final String name;
|
||||
public final String description;
|
||||
public final String usage;
|
||||
private final CommandManager commandManager;
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final String usage;
|
||||
private final List<CommandPermission> permissions;
|
||||
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!");
|
||||
}
|
||||
|
||||
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() {
|
||||
return new ArrayList<>(permissions);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
@@ -23,7 +9,7 @@ import java.util.List;
|
||||
|
||||
public abstract class CommandExecutor {
|
||||
|
||||
public final String name;
|
||||
private final String name;
|
||||
private final List<CommandPermission> permissions;
|
||||
|
||||
public CommandExecutor(String name, CommandPermission... permissions) {
|
||||
@@ -33,15 +19,19 @@ public abstract class CommandExecutor {
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandPermission permission) {
|
||||
public final boolean hasPermission(CommandPermission 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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.command.events.*;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.EventManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
|
||||
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;
|
||||
|
||||
public CommandManager(EventManager eventManager) {
|
||||
this.commands = new ArrayList<>();
|
||||
this.eventManager = eventManager;
|
||||
}
|
||||
|
||||
public final void registerCommand(Command command) {
|
||||
if (this.commands.contains(command)) return;
|
||||
this.commands.add(command);
|
||||
// Registriere die Klasse, instanziiere sie einmalig
|
||||
public final void registerCommand(Class<? extends Command> commandClass) {
|
||||
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) {
|
||||
if (!this.commands.contains(command)) return;
|
||||
this.commands.remove(command);
|
||||
public final void unregisterCommand(Class<? extends Command> commandClass) {
|
||||
commandInstances.remove(commandClass);
|
||||
}
|
||||
|
||||
public List<Command> getCommands() {
|
||||
return new ArrayList<>(commands);
|
||||
return new ArrayList<>(commandInstances.values());
|
||||
}
|
||||
|
||||
public Command getCommandByName(String name) {
|
||||
for (Command command : commands) if (command.name.equals(name)) return command;
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
for (Command cmd : commandInstances.values()) {
|
||||
if (cmd.getName().equalsIgnoreCase(name)) return cmd;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Command getCommandByAlias(String alias) {
|
||||
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;
|
||||
for (Command cmd : commandInstances.values()) {
|
||||
for (String a : cmd.getAliases()) {
|
||||
if (a.equalsIgnoreCase(alias)) return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Command getCommand(String input) {
|
||||
if (getCommandByName(input) != null) return getCommandByName(input);
|
||||
if (getCommandByAlias(input) != null) return getCommandByAlias(input);
|
||||
return null;
|
||||
Command cmd = getCommandByName(input);
|
||||
return (cmd != null) ? cmd : getCommandByAlias(input);
|
||||
}
|
||||
|
||||
public void execute(CommandExecutor commandExecutor, String line) {
|
||||
String[] split = line.split(" ");
|
||||
String command = split[0];
|
||||
public void execute(CommandExecutor executor, String line) {
|
||||
String[] split = line.trim().split("\\s+");
|
||||
if (split.length == 0) return;
|
||||
|
||||
String commandLabel = split[0];
|
||||
String[] args = Arrays.copyOfRange(split, 1, split.length);
|
||||
|
||||
if (getCommand(command) != null) {
|
||||
Command cmd = getCommand(command);
|
||||
PreCommandExecuteEvent preEvent = new PreCommandExecuteEvent(this, commandExecutor, cmd);
|
||||
eventManager.executeEvent(preEvent);
|
||||
Command command = getCommand(commandLabel);
|
||||
if (command == null) {
|
||||
eventManager.executeEvent(new CommandNotFoundEvent(this, executor, commandLabel, args));
|
||||
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())) {
|
||||
CommandExecuteEvent event = new CommandExecuteEvent(this, commandExecutor, cmd);
|
||||
eventManager.executeEvent(event);
|
||||
// Check permissions
|
||||
if (!executor.hasPermissions(command.getPermissions())) {
|
||||
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);
|
||||
eventManager.executeEvent(new CommandExecutedEvent(this, commandExecutor, cmd));
|
||||
} else eventManager.executeEvent(new CommandExecutorMissingPermissionEvent(this, commandExecutor, cmd));
|
||||
} else eventManager.executeEvent(new CommandNotFoundEvent(this, commandExecutor, command, args));
|
||||
// Execute command
|
||||
command.execute(executor, commandLabel, args);
|
||||
|
||||
// Post-execute event
|
||||
eventManager.executeEvent(new CommandExecutedEvent(this, executor, command));
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
|
||||
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.CancellableEvent;
|
||||
|
||||
public class CommandExecuteEvent extends CancellableEvent {
|
||||
public final CommandManager commandManager;
|
||||
public final CommandExecutor commandExecutor;
|
||||
public final Command command;
|
||||
public final class CommandExecuteEvent extends CancellableEvent {
|
||||
private final CommandManager commandManager;
|
||||
private final CommandExecutor commandExecutor;
|
||||
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) {
|
||||
this.commandManager = commandManager;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
|
||||
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
|
||||
public class CommandExecutedEvent extends Event {
|
||||
public final CommandManager commandManager;
|
||||
public final CommandExecutor commandExecutor;
|
||||
public final Command command;
|
||||
public final class CommandExecutedEvent extends Event {
|
||||
private final CommandManager commandManager;
|
||||
private final CommandExecutor commandExecutor;
|
||||
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) {
|
||||
this.commandManager = commandManager;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
|
||||
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
|
||||
public class CommandExecutorMissingPermissionEvent extends Event {
|
||||
public final CommandManager commandManager;
|
||||
public final CommandExecutor commandExecutor;
|
||||
public final Command command;
|
||||
public final class CommandExecutorMissingPermissionEvent extends Event {
|
||||
private final CommandManager commandManager;
|
||||
private final CommandExecutor commandExecutor;
|
||||
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) {
|
||||
this.commandManager = commandManager;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -20,11 +6,27 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
|
||||
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
|
||||
public class CommandNotFoundEvent extends Event {
|
||||
public final CommandManager commandManager;
|
||||
public final CommandExecutor commandExecutor;
|
||||
public final String name;
|
||||
public final String[] args;
|
||||
public final class CommandNotFoundEvent extends Event {
|
||||
private final CommandManager commandManager;
|
||||
private final CommandExecutor commandExecutor;
|
||||
private final String name;
|
||||
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) {
|
||||
this.commandManager = commandManager;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -21,10 +7,22 @@ import dev.unlegitdqrk.unlegitlibrary.command.CommandExecutor;
|
||||
import dev.unlegitdqrk.unlegitlibrary.command.CommandManager;
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.CancellableEvent;
|
||||
|
||||
public class PreCommandExecuteEvent extends CancellableEvent {
|
||||
public final CommandManager commandManager;
|
||||
public final CommandExecutor commandExecutor;
|
||||
public final Command command;
|
||||
public final class PreCommandExecuteEvent extends CancellableEvent {
|
||||
private final CommandManager commandManager;
|
||||
private final CommandExecutor commandExecutor;
|
||||
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) {
|
||||
this.commandManager = commandManager;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
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.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
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 HashMap<EventListener, Object> eventListeners = new HashMap<>();
|
||||
private final Map<Class<? extends Event>, Map<EventPriority, Map<Object, Method>>> registeredListener = 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;
|
||||
|
||||
for (Method method : listenerClass.getClass().getDeclaredMethods()) {
|
||||
Listener listener = method.getAnnotation(Listener.class);
|
||||
Object instance = listenerClass.getDeclaredConstructor().newInstance();
|
||||
|
||||
if (listener == null) continue;
|
||||
for (Method method : listenerClass.getDeclaredMethods()) {
|
||||
Listener listenerAnnotation = method.getAnnotation(Listener.class);
|
||||
|
||||
if (method.getParameterCount() == 1) {
|
||||
Class<? extends Event> eventClass = (Class<? extends Event>) method.getParameterTypes()[0];
|
||||
if (listenerAnnotation == null || method.getParameterCount() != 1) continue;
|
||||
|
||||
HashMap<EventPriority, HashMap<Object, Method>> list = registeredListener.getOrDefault(eventClass, new HashMap<>());
|
||||
HashMap<Object, Method> set = list.getOrDefault(listener.priority(), new HashMap<>());
|
||||
Class<?> paramType = method.getParameterTypes()[0];
|
||||
if (!Event.class.isAssignableFrom(paramType)) continue;
|
||||
|
||||
set.put(listenerClass, method);
|
||||
list.put(listener.priority(), set);
|
||||
registeredListener.put(eventClass, list);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Event> eventClass = (Class<? extends Event>) paramType;
|
||||
|
||||
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;
|
||||
|
||||
Object clazz = eventListeners.get(listenerClass);
|
||||
Object instance = eventListeners.get(listenerClass);
|
||||
|
||||
synchronized (registeredListener) {
|
||||
List<Class<? extends Event>> eventsToRemove = new ArrayList<>();
|
||||
|
||||
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);
|
||||
for (Map<EventPriority, Map<Object, Method>> priorityMap : registeredListener.values()) {
|
||||
for (Map<Object, Method> listeners : priorityMap.values()) {
|
||||
listeners.remove(instance);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up empty entries
|
||||
registeredListener.entrySet().removeIf(e ->
|
||||
e.getValue().values().stream().allMatch(Map::isEmpty));
|
||||
|
||||
eventListeners.remove(listenerClass);
|
||||
}
|
||||
|
||||
public final boolean isListenerRegistered(EventListener listenerClass) {
|
||||
public final boolean isListenerRegistered(Class<? extends EventListener> listenerClass) {
|
||||
return eventListeners.containsKey(listenerClass);
|
||||
}
|
||||
|
||||
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) -> {
|
||||
if (!isListenerRegistered((EventListener) k)) return;
|
||||
for (EventPriority priority : EventPriority.values()) {
|
||||
Map<Object, Method> listeners = listenersByPriority.getOrDefault(priority, Collections.emptyMap());
|
||||
|
||||
try {
|
||||
v.invoke(k, event);
|
||||
} catch (IllegalAccessException | InvocationTargetException exception) {
|
||||
exception.printStackTrace();
|
||||
for (Map.Entry<Object, Method> entry : listeners.entrySet()) {
|
||||
Object instance = entry.getKey();
|
||||
Method method = entry.getValue();
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -22,7 +8,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
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<>());
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -17,7 +10,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ConfigurationManager extends DefaultMethodsOverrider {
|
||||
public final class ConfigurationManager extends DefaultMethodsOverrider {
|
||||
private final Properties properties = new Properties();
|
||||
private final File configFile;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -31,7 +17,7 @@ import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
public class FileUtils extends DefaultMethodsOverrider {
|
||||
public final class FileUtils extends DefaultMethodsOverrider {
|
||||
|
||||
public static String getSuffix(File file) {
|
||||
String[] splitName = file.getName().split("\\.");
|
||||
|
@@ -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;
|
||||
|
||||
@@ -23,7 +9,7 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
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) {
|
||||
for (Method method : clazz.getDeclaredMethods())
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.packets.Packet;
|
||||
|
||||
public class C_PacketReceivedEvent extends Event {
|
||||
public final NetworkClient networkClient;
|
||||
public final Packet packet;
|
||||
public final class C_PacketReceivedEvent extends Event {
|
||||
private final NetworkClient networkClient;
|
||||
private final Packet packet;
|
||||
|
||||
public NetworkClient getNetworkClient() {
|
||||
return networkClient;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public C_PacketReceivedEvent(NetworkClient networkClient, Packet packet) {
|
||||
this.networkClient = networkClient;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.packets.Packet;
|
||||
|
||||
public class C_PacketReceivedFailedEvent extends Event {
|
||||
public final NetworkClient networkClient;
|
||||
public final Packet packet;
|
||||
public final class C_PacketReceivedFailedEvent extends Event {
|
||||
private final NetworkClient networkClient;
|
||||
private final Packet packet;
|
||||
|
||||
public NetworkClient getNetworkClient() {
|
||||
return networkClient;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public C_PacketReceivedFailedEvent(NetworkClient networkClient, Packet packet) {
|
||||
this.networkClient = networkClient;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.packets.Packet;
|
||||
|
||||
public class C_PacketSendEvent extends Event {
|
||||
public final NetworkClient networkClient;
|
||||
public final Packet packet;
|
||||
public final class C_PacketSendEvent extends Event {
|
||||
private final NetworkClient networkClient;
|
||||
private final Packet packet;
|
||||
|
||||
public NetworkClient getNetworkClient() {
|
||||
return networkClient;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public C_PacketSendEvent(NetworkClient networkClient, Packet packet) {
|
||||
this.networkClient = networkClient;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.packets.Packet;
|
||||
|
||||
public class C_PacketSendFailedEvent extends Event {
|
||||
public final NetworkClient networkClient;
|
||||
public final Packet packet;
|
||||
public final class C_PacketSendFailedEvent extends Event {
|
||||
private final NetworkClient networkClient;
|
||||
private final Packet packet;
|
||||
|
||||
|
||||
public NetworkClient getNetworkClient() {
|
||||
return networkClient;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public C_PacketSendFailedEvent(NetworkClient networkClient, Packet packet) {
|
||||
this.networkClient = networkClient;
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
|
||||
|
||||
public class C_UnknownObjectReceivedEvent extends Event {
|
||||
public final NetworkClient networkClient;
|
||||
public final Object received;
|
||||
public final class C_UnknownObjectReceivedEvent extends Event {
|
||||
private final NetworkClient networkClient;
|
||||
private final Object received;
|
||||
|
||||
public NetworkClient getNetworkClient() {
|
||||
return networkClient;
|
||||
}
|
||||
|
||||
public Object getReceived() {
|
||||
return received;
|
||||
}
|
||||
|
||||
public C_UnknownObjectReceivedEvent(NetworkClient networkClient, Object received) {
|
||||
this.networkClient = networkClient;
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
|
||||
|
||||
public class ClientConnectedEvent extends Event {
|
||||
public final NetworkClient client;
|
||||
public final class ClientConnectedEvent extends Event {
|
||||
private final NetworkClient client;
|
||||
|
||||
|
||||
public NetworkClient getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
public ClientConnectedEvent(NetworkClient client) {
|
||||
this.client = client;
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
import dev.unlegitdqrk.unlegitlibrary.network.system.client.NetworkClient;
|
||||
|
||||
public class ClientDisconnectedEvent extends Event {
|
||||
public final NetworkClient client;
|
||||
public final class ClientDisconnectedEvent extends Event {
|
||||
private final NetworkClient client;
|
||||
|
||||
public NetworkClient getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
public ClientDisconnectedEvent(NetworkClient client) {
|
||||
this.client = client;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -23,7 +9,7 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
public class ClientIDPacket extends Packet {
|
||||
public final class ClientIDPacket extends Packet {
|
||||
private int clientID;
|
||||
|
||||
public ClientIDPacket() {
|
||||
|
@@ -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;
|
||||
|
||||
@@ -18,7 +11,7 @@ import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.net.SocketException;
|
||||
|
||||
public class ConnectionHandler {
|
||||
public final class ConnectionHandler {
|
||||
private SSLSocket socket;
|
||||
private int clientID;
|
||||
private ObjectOutputStream outputStream;
|
||||
@@ -31,19 +24,19 @@ public class ConnectionHandler {
|
||||
return target.getClientID() == clientID;
|
||||
}
|
||||
|
||||
public SSLSocket getSocket() {
|
||||
public final SSLSocket getSocket() {
|
||||
return socket;
|
||||
}
|
||||
|
||||
public ObjectOutputStream getOutputStream() {
|
||||
public final ObjectOutputStream getOutputStream() {
|
||||
return outputStream;
|
||||
}
|
||||
|
||||
public ObjectInputStream getInputStream() {
|
||||
public final ObjectInputStream getInputStream() {
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
public NetworkServer getServer() {
|
||||
public final NetworkServer getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -36,7 +29,7 @@ public final class NetworkServer {
|
||||
private final List<ConnectionHandler> connectionHandlers = new ArrayList<>();
|
||||
private final Thread incomingThread = new Thread(this::incomingConnections);
|
||||
|
||||
public List<ConnectionHandler> getConnectionHandlers() {
|
||||
public final List<ConnectionHandler> getConnectionHandlers() {
|
||||
return connectionHandlers;
|
||||
}
|
||||
|
||||
@@ -51,7 +44,7 @@ public final class NetworkServer {
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
public final int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -20,7 +6,11 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
|
||||
|
||||
public final class ConnectionHandlerConnectedEvent extends Event {
|
||||
public final ConnectionHandler connectionHandler;
|
||||
private final ConnectionHandler connectionHandler;
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public ConnectionHandlerConnectedEvent(ConnectionHandler connectionHandler) {
|
||||
this.connectionHandler = connectionHandler;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -20,7 +6,12 @@ import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
|
||||
|
||||
public final class ConnectionHandlerDisconnectedEvent extends Event {
|
||||
public final ConnectionHandler connectionHandler;
|
||||
private final ConnectionHandler connectionHandler;
|
||||
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public ConnectionHandlerDisconnectedEvent(ConnectionHandler connectionHandler) {
|
||||
this.connectionHandler = connectionHandler;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -21,9 +7,17 @@ import dev.unlegitdqrk.unlegitlibrary.network.system.server.NetworkServer;
|
||||
|
||||
import javax.net.ssl.SSLSocket;
|
||||
|
||||
public class IncomingConnectionEvent extends CancellableEvent {
|
||||
public final NetworkServer server;
|
||||
public final SSLSocket socket;
|
||||
public final class IncomingConnectionEvent extends CancellableEvent {
|
||||
private final NetworkServer server;
|
||||
private final SSLSocket socket;
|
||||
|
||||
public SSLSocket getSocket() {
|
||||
return socket;
|
||||
}
|
||||
|
||||
public NetworkServer getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public IncomingConnectionEvent(NetworkServer server, SSLSocket socket) {
|
||||
this.server = server;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.server.ConnectionHandler;
|
||||
|
||||
public class S_PacketReceivedEvent extends Event {
|
||||
public final ConnectionHandler connectionHandler;
|
||||
public final Packet packet;
|
||||
public final class S_PacketReceivedEvent extends Event {
|
||||
private final ConnectionHandler connectionHandler;
|
||||
private final Packet packet;
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public S_PacketReceivedEvent(ConnectionHandler connectionHandler, Packet packet) {
|
||||
this.connectionHandler = connectionHandler;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.server.ConnectionHandler;
|
||||
|
||||
public class S_PacketReceivedFailedEvent extends Event {
|
||||
public final ConnectionHandler connectionHandler;
|
||||
public final Packet packet;
|
||||
public final class S_PacketReceivedFailedEvent extends Event {
|
||||
private final ConnectionHandler connectionHandler;
|
||||
private final Packet packet;
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public S_PacketReceivedFailedEvent(ConnectionHandler connectionHandler, Packet packet) {
|
||||
this.connectionHandler = connectionHandler;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.server.ConnectionHandler;
|
||||
|
||||
public class S_PacketSendEvent extends Event {
|
||||
public final Packet packet;
|
||||
public final ConnectionHandler connectionHandler;
|
||||
public final class S_PacketSendEvent extends Event {
|
||||
private final Packet packet;
|
||||
private final ConnectionHandler connectionHandler;
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public S_PacketSendEvent(Packet packet, ConnectionHandler connectionHandler) {
|
||||
this.packet = packet;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -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.server.ConnectionHandler;
|
||||
|
||||
public class S_PacketSendFailedEvent extends Event {
|
||||
public final Packet packet;
|
||||
public final ConnectionHandler connectionHandler;
|
||||
public final class S_PacketSendFailedEvent extends Event {
|
||||
private final Packet packet;
|
||||
private final ConnectionHandler connectionHandler;
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public Packet getPacket() {
|
||||
return packet;
|
||||
}
|
||||
|
||||
public S_PacketSendFailedEvent(Packet packet, ConnectionHandler connectionHandler) {
|
||||
this.packet = packet;
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.impl.Event;
|
||||
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;
|
||||
public final ConnectionHandler connectionHandler;
|
||||
private final Object received;
|
||||
private final ConnectionHandler connectionHandler;
|
||||
|
||||
public ConnectionHandler getConnectionHandler() {
|
||||
return connectionHandler;
|
||||
}
|
||||
|
||||
public Object getReceived() {
|
||||
return received;
|
||||
}
|
||||
|
||||
public S_UnknownObjectReceivedEvent(Object received, ConnectionHandler connectionHandler) {
|
||||
this.received = received;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
}
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.number.MathHelper;
|
||||
import dev.unlegitdqrk.unlegitlibrary.number.math.MathHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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 {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
|
||||
package dev.unlegitdqrk.unlegitlibrary.number.math.vector;
|
||||
|
||||
public enum Axis {
|
||||
X, Y, Z
|
||||
}
|
@@ -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 {
|
||||
|
@@ -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 float x;
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.number.MathHelper;
|
||||
import dev.unlegitdqrk.unlegitlibrary.number.math.MathHelper;
|
||||
|
||||
public class Color {
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -210,4 +203,16 @@ public final class Logger {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isInitialized() {
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
public final File getLatestLogFile() {
|
||||
return latestLogFile;
|
||||
}
|
||||
|
||||
public final File getLogFolder() {
|
||||
return logFolder;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user