Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-krueger committed Nov 15, 2017
1 parent a999d2a commit a73b722
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 124 deletions.
51 changes: 4 additions & 47 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,4 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

.class
.idea/
target/
build/
Pipeline.iml
36 changes: 0 additions & 36 deletions Pipeline.iml

This file was deleted.

6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.McAPI</groupId>
<artifactId>Pipeline</artifactId>
<version>0.2-alpha</version>
<version>0.3-alpha</version>

<repositories>
<repository>
Expand All @@ -30,7 +30,7 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>F:\Sponge Server\mods</outputDirectory>
<outputDirectory>E:\Servers\sponge\mods</outputDirectory>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
<version>4.0.1</version>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
22 changes: 9 additions & 13 deletions src/main/java/de/McAPI/Pipeline/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.security.Key;
import java.util.Optional;

@Plugin(id = "pipeline", name = "Pipeline", version = "0.1-alpha", url = "http://mcapi.de", authors = "Yonas")
@Plugin(id = "pipeline", name = "Pipeline", version = "0.3-alpha", url = "http://mcapi.de", authors = "Yonas")
public class Pipeline {

public final static AttributeKey<Pipeline> PLUGIN_ATTRIBUTE_KEY = AttributeKey.valueOf("key_pipeline_plugin");
Expand Down Expand Up @@ -151,21 +151,17 @@ protected void initChannel(NioSocketChannel channel) throws Exception {

})
.bind(host, port)
.addListener(new ChannelFutureListener() {
.addListener((ChannelFutureListener) channelFuture -> {

public void operationComplete(ChannelFuture channelFuture) throws Exception {
if (channelFuture.isSuccess()) {
channel = channelFuture.channel();
logger.info("Pipeline is now open.");
} else {
logger.info("Pipeline wasn't able to let the oil threw...");

if (channelFuture.isSuccess()) {
channel = channelFuture.channel();
logger.info("Pipeline is now open.");
} else {
logger.info("Pipeline wasn't able to let the oil threw...");

if (isDebug() && !(channelFuture.cause() == null)) {
logger.info(channelFuture.cause().getMessage());
}
if (isDebug() && !(channelFuture.cause() == null)) {
logger.info(channelFuture.cause().getMessage());
}

}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void decode(ChannelHandlerContext context, String input, List<Object>
}

// If the key is null or it doesnt match the session key, then we will drop the connection.
if(providedKey == null || !(providedKey.toString().equals(session.getKey()))) {
if(providedKey == null || !(providedKey.equals(session.getKey()))) {
if(pipeline.isDebug()) {
pipeline.logger().info(String.format(
"[%s] The provided key (%s) is not valid or not equals to the session key.",
Expand Down Expand Up @@ -100,7 +100,6 @@ protected void decode(ChannelHandlerContext context, String input, List<Object>
list.add(pipelineResponse);
context.pipeline().remove(this);


}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.McAPI.Pipeline.Session;
import de.McAPI.Pipeline.exception.PipelineException;
import de.McAPI.Pipeline.protocol.response.PipelineResponse;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
Expand Down Expand Up @@ -38,7 +39,11 @@ protected void channelRead0(ChannelHandlerContext context, PipelineResponse pipe


JsonObject jsonObject = new JsonObject();
int responseLength = pipelineResponse.getResponse().getBytes().length;
ByteBuf responseBuffer = Unpooled.copiedBuffer(
pipelineResponse.getResponse() + "\0",
StandardCharsets.UTF_8
);
int responseLength = responseBuffer.array().length;
jsonObject.addProperty("length", responseLength);

context.pipeline().writeAndFlush(
Expand All @@ -55,12 +60,7 @@ protected void channelRead0(ChannelHandlerContext context, PipelineResponse pipe
));
}

context.pipeline().writeAndFlush(
Unpooled.copiedBuffer(
pipelineResponse.getResponse() + "\0",
StandardCharsets.UTF_8
)
).addListener(ChannelFutureListener.CLOSE);
context.pipeline().writeAndFlush(responseBuffer).addListener(ChannelFutureListener.CLOSE);

if(pipeline.isDebug()) {
pipeline.logger().info(String.format(
Expand All @@ -73,8 +73,7 @@ protected void channelRead0(ChannelHandlerContext context, PipelineResponse pipe
if(pipeline.isDebug()) {
pipeline.logger().info(String.format(
"[%s] Finished request.",
session.getDebugKey(),
responseLength
session.getDebugKey()
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public void build() {
entry.addProperty("identifier", world.getUniqueId().toString());
entry.addProperty("name", world.getName());
entry.addProperty("difficulty", world.getDifficulty().getName());
entry.addProperty("dimension", world.getDimension().getName());
entry.addProperty("generatorType", world.getDimension().getGeneratorType().getName());


Expand Down
Binary file modified target/classes/de/McAPI/Pipeline/Pipeline$1.class
Binary file not shown.
Binary file removed target/classes/de/McAPI/Pipeline/Pipeline$2.class
Binary file not shown.
Binary file modified target/classes/de/McAPI/Pipeline/Pipeline.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 7 additions & 1 deletion target/classes/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
{
"modid": "pipeline",
"name": "Pipeline",
"version": "0.1-alpha",
"version": "0.3-alpha",
"url": "http://mcapi.de",
"authorList": [
"Yonas"
],
"dependencies": [
"[email protected]"
],
"requiredMods": [
"[email protected]"
]
}
]
4 changes: 2 additions & 2 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven
#Sun Apr 10 15:48:48 CEST 2016
version=0.2-alpha
#Wed Nov 15 02:11:19 CET 2017
groupId=de.McAPI
artifactId=Pipeline
version=0.3-alpha
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ de\McAPI\Pipeline\exception\PipelineException.class
de\McAPI\Pipeline\Pipeline.class
de\McAPI\Pipeline\protocol\response\PipelineResponse.class
de\McAPI\Pipeline\protocol\PipelineRequestDecoder.class
de\McAPI\Pipeline\Pipeline$2.class
de\McAPI\Pipeline\Token.class
de\McAPI\Pipeline\Session.class
mcmod.info
de\McAPI\Pipeline\protocol\PipelineHandshakeHandler.class
de\McAPI\Pipeline\Pipeline$1.class
de\McAPI\Pipeline\protocol\PipelineHandshakeHandler.class
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\Session.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\protocol\PipelineRequestDecoder.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\protocol\PipelineResponseHandler.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\protocol\response\PipelineResponse.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\exception\PipelineException.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\Pipeline.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\Token.java
G:\Q1\workspace\Pipeline\src\main\java\de\McAPI\Pipeline\protocol\PipelineHandshakeHandler.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\exception\PipelineException.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\protocol\PipelineRequestDecoder.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\protocol\response\PipelineResponse.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\Session.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\protocol\PipelineHandshakeHandler.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\Pipeline.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\protocol\PipelineResponseHandler.java
E:\workspace\private\Sponge-Pipeline\src\main\java\de\McAPI\Pipeline\Token.java

0 comments on commit a73b722

Please sign in to comment.