Skip to content

Commit

Permalink
Fixed that lombok has to be added as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
netcodedev committed Feb 12, 2024
1 parent e396b3b commit 1771dbc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ build
.project
.classpath

# Ignore idea settings
.idea

# Ignore compiled binaries
bin
*.class

# Ignore files with sensizive data
gradle.properties
secring.gpg

# Ignore vscode files
.vscode
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = 'dev.bitbite'
version = '2.0.1'
version = '2.0.2'

java {
toolchain {
Expand All @@ -21,7 +21,7 @@ publishing {
from components.java
groupId = 'dev.bitbite'
artifactId = 'OpenNetLib'
version = '2.0.1'
version = '2.0.2'
pom {
name = 'OpenNetLib - A Java Networking Library'
description = 'OpenNetLib is a lightweight, easy-to-use library to simplify socket communication. It is written in and for Java. It\'s still in an early stage but saves a lot of time already. Start using OpenNetLib today or help improving it by posting issues, questions and feature requests here: https://github.com/bitbitedev/OpenNetLib/issues'
Expand Down Expand Up @@ -82,7 +82,6 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'

//lombok
implementation 'org.projectlombok:lombok:1.18.30'
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void flushRead() {

/**
* Blocks until the given amount of bytes are read
* @param amount
* @param amount of bytes to read
*/
public void readNBytes(int amount) {
this.iOHandler.readToNBytes(amount);
Expand Down
24 changes: 10 additions & 14 deletions src/main/java/dev/bitbite/networking/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected void openServerSocket() throws IOException {

/**
* Initiates the closing process of the Server with closing the {@link ClientManager} and disabling the {@link DataProcessingLayer}s.
* Finally it closes the serverSocket
* Finally, it closes the serverSocket
*/
public void close() {
this.notifyListeners(EventType.CLOSE);
Expand Down Expand Up @@ -168,19 +168,15 @@ public void registerListener(IOHandlerListener listener) {
* @param listener to remove
*/
public void removeListener(ServerListener listener) {
if(listeners.contains(listener)) {
listeners.remove(listener);
}
listeners.remove(listener);
}

/**
* Removes IOHandlerListener from the listeners
* @param listener to remove
*/
public void removeListener(IOHandlerListener listener) {
if(iOListeners.contains(listener)) {
iOListeners.remove(listener);
}
iOListeners.remove(listener);
}

/**
Expand All @@ -201,10 +197,10 @@ protected void notifyListeners(EventType type, Object... args) {
}
switch(type) {
case START:
this.listeners.forEach(l -> l.onStart());
this.listeners.forEach(ServerListener::onStart);
break;
case START_SUCCESS:
this.listeners.forEach(l -> l.onStartSuccess());
this.listeners.forEach(ServerListener::onStartSuccess);
break;
case START_FAILED:
if(args.length == 0) {
Expand All @@ -223,10 +219,10 @@ protected void notifyListeners(EventType type, Object... args) {
this.listeners.forEach(l -> l.onAccept((CommunicationHandler)args[0]));
break;
case ACCEPT_END:
this.listeners.forEach(l -> l.onAcceptEnd());
this.listeners.forEach(ServerListener::onAcceptEnd);
break;
case ACCEPT_START:
this.listeners.forEach(l -> l.onAcceptStart());
this.listeners.forEach(ServerListener::onAcceptStart);
break;
case ACCEPT_FAILED:
if(args.length == 0) {
Expand All @@ -244,7 +240,7 @@ protected void notifyListeners(EventType type, Object... args) {
throw new IllegalArgumentException("Expected object of type Exception, but got "+args[0].getClass().getSimpleName());
}
this.listeners.forEach(l -> l.onSocketClosed((Exception)args[0]));
} else if(args.length >= 2) {
} else {
if(!(args[0] instanceof Exception) || !(args[1] instanceof String)) {
throw new IllegalArgumentException("Expected objects of type Exception and String, but got "+args[0].getClass().getSimpleName()+" and "+args[1].getClass().getSimpleName());
}
Expand All @@ -253,10 +249,10 @@ protected void notifyListeners(EventType type, Object... args) {

break;
case CLOSE:
this.listeners.forEach(l -> l.onClose());
this.listeners.forEach(ServerListener::onClose);
break;
case CLOSE_END:
this.listeners.forEach(l -> l.onCloseEnd());
this.listeners.forEach(ServerListener::onCloseEnd);
break;
case CLOSE_FAILED:
if(args.length == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module dev.bitbite.opennetlib {
exports dev.bitbite.networking.exceptions;
exports dev.bitbite.networking;
requires transitive lombok;
requires lombok;
}

0 comments on commit 1771dbc

Please sign in to comment.