Skip to content

Commit

Permalink
Adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
comroid-commit committed Oct 26, 2018
1 parent 079a91c commit c4f041e
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 60 deletions.
13 changes: 0 additions & 13 deletions .idea/artifacts/CrystalShard_main_jar.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/artifacts/Dependencies.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/artifacts/Main.xml

This file was deleted.

2 changes: 1 addition & 1 deletion Core-11/Core-11.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":Core-11" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="de.kaleidox" external.system.module.version="0.8" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":Core-11" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="de.kaleidox" external.system.module.version="0.9" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public WebSocketClientImpl(Discord discordObject) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> webSocket.sendClose(1000, "Shutting down!")));
}

public CompletableFuture<WebSocket> sendPayload(Payload payload) {
public CompletableFuture<Void> sendPayload(Payload payload) {
assert payload != null : "Payload must not be null!";
CompletableFuture<WebSocket> future = new CompletableFuture<>();
this.threadPool.execute(() -> {
Expand Down Expand Up @@ -75,7 +75,7 @@ public CompletableFuture<WebSocket> sendPayload(Payload payload) {
}
}
});
return future;
return future.thenApply(n -> null);
}

private void identification() {
Expand Down
2 changes: 1 addition & 1 deletion Internal-11/Internal-11.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":Internal-11" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="de.kaleidox" external.system.module.version="0.8" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":Internal-11" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="de.kaleidox" external.system.module.version="0.9" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
2 changes: 1 addition & 1 deletion Main/Main.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":Main" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="de.kaleidox" external.system.module.version="0.8" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":Main" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="de.kaleidox" external.system.module.version="0.9" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public Endpoint toEndpoint(Object... parameter) {
}
}
if (parameterCount == params.length) {
boolean olderInstanceExists = olderInstances.entrySet().stream().anyMatch(entry -> Arrays.compare(entry.getKey(), params) == 0);
boolean olderInstanceExists = olderInstances.entrySet().stream().anyMatch(entry -> ArrayHelper.compare(entry.getKey(), params) == 0);
if (olderInstanceExists) {
for (Map.Entry<String[], Endpoint> entry : olderInstances.entrySet()) {
if (ArrayHelper.compare(entry.getKey(), params) == 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package de.kaleidox.crystalshard.core.net.socket;

import java.net.http.WebSocket;
import java.util.concurrent.CompletableFuture;

public interface WebSocketClient {
CompletableFuture<WebSocket> sendPayload(Payload payload);
CompletableFuture<Void> sendPayload(Payload payload);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package de.kaleidox.crystalshard.main;

public class CrystalShard {
// Static Fields
public static final String VERSION = "1.0";
public static final String VERSION = "0.9";
public static final String SHORT_FOOTPRINT = "CrystalShard v" + VERSION;
public static final int API_VERSION = 6;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.kaleidox.crystalshard.main.exception;

import de.kaleidox.crystalshard.main.items.permission.Permission;
import de.kaleidox.crystalshard.util.helpers.ListHelper;

import java.util.List;

Expand All @@ -13,6 +14,6 @@ public DiscordPermissionException(String message, Permission... lackingPermissio
}

public List<Permission> getLackingPermission() {
return List.of(lackingPermission);
return ListHelper.of(lackingPermission);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface Channel
CompletableFuture<Void> delete();

default boolean isPrivate() {
return toServerChannel().isEmpty();
return !toServerChannel().isPresent();
}

default Optional<ChannelCategory> toChannelCategory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.kaleidox.crystalshard.internal.InternalDelegate;
import de.kaleidox.crystalshard.main.Discord;
import de.kaleidox.crystalshard.main.exception.DiscordPermissionException;
import de.kaleidox.crystalshard.main.exception.IllegalThreadException;
import de.kaleidox.crystalshard.main.handling.listener.ListenerAttachable;
import de.kaleidox.crystalshard.main.handling.listener.message.MessageAttachableListener;
import de.kaleidox.crystalshard.main.items.DiscordItem;
Expand Down Expand Up @@ -390,7 +391,7 @@ interface BulkDelete {
CompletableFuture<Void> deleteAll();
}

static CompletableFuture<Void> bulkDelete(long channelId, @NotContainNull @Range(min = 2, max = 100) long... messageIds) throws IllegalCallerException {
static CompletableFuture<Void> bulkDelete(long channelId, @NotContainNull @Range(min = 2, max = 100) long... messageIds) throws IllegalThreadException {
Discord discord = ThreadPool.getThreadDiscord();
return InternalDelegate.newInstance(BulkDelete.class, discord).setChannel(channelId).addIds(messageIds).deleteAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void onReactionAdd(ReactionAddEvent event) {
.contains(event.getEmoji().toDiscordPrintable())) {
Optional<Choice<T>> any = choices.stream().filter(choice -> choice.getEmojiRepresentation()
.equals(event.getEmoji().toDiscordPrintable())).findAny();
if (any.isEmpty()) {
if (!any.isPresent()) {
event.getReaction().remove();
assert false : "This point should never be reached.";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class FutureHelper extends NullHelper {
*/
@SafeVarargs
public static <T> CompletableFuture<T> linkFutures(CompletableFuture<T> parentFuture, CompletableFuture<T>... others) {
List.of(others).forEach(otherFuture -> {
ListHelper.of(others).forEach(otherFuture -> {
parentFuture.thenAcceptAsync(otherFuture::complete);
parentFuture.exceptionally(throwable -> {
otherFuture.completeExceptionally(throwable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static <iK, iV, oK, oV, iMap extends Map<iK, iV>, oMap extends Map<oK, oV
Function<iK, oK> keyMapper, Function<iV, oV> valueMapper) {
Comparator<iK> comparator = (map instanceof TreeMap) ? ((TreeMap) map).comparator() : null;
oMap newMap;
newMap = (oMap) Objects.requireNonNullElse(outputMapPointer, new HashMap<oK, oV>());
newMap = (oMap) NullHelper.requireNonNullElse(outputMapPointer, new HashMap<oK, oV>());
newMap = (oMap) getMapOfParent(map, newMap);
for (Map.Entry<iK, iV> entry : map.entrySet()) {
newMap.put(keyMapper.apply(entry.getKey()), valueMapper.apply(entry.getValue()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.kaleidox.crystalshard.util.helpers;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class NullHelper {
Expand All @@ -15,4 +17,9 @@ public static void requireNonNull(Object... items) {
Objects.requireNonNull(item);
}
}

protected static <T> Object requireNonNullElse(T test, T orElse) {
if (Objects.isNull(test)) return orElse;
return test;
}
}
19 changes: 8 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ task myJavadocs(type: Javadoc) {
javadoc {
options.encoding = 'UTF-8'
options.destinationDirectory(new File("A:\\Workspaces\\CrystalShardDocumentation\\"))
exclude("internal")
}

publishing {
Expand All @@ -22,8 +21,7 @@ publishing {

allprojects {
group 'de.kaleidox'
version '0.8'


apply plugin: 'java-library'

compileJava {
Expand All @@ -36,36 +34,35 @@ allprojects {

dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.3'
implementation 'com.vdurmont:emoji-java:4.0.0'
}
}

project(":Main") {
version '0.9'

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
implementation 'com.vdurmont:emoji-java:4.0.0'
}
}

project(":Core-11") {
version '0.9'

sourceCompatibility = 11
targetCompatibility = 11

dependencies {
implementation project(":Main")

implementation 'com.vdurmont:emoji-java:4.0.0'
}
}

project(":Internal-11") {
version '0.9'

sourceCompatibility = 11
targetCompatibility = 11

dependencies {
implementation project(":Main")

implementation 'com.vdurmont:emoji-java:4.0.0'
}
}

0 comments on commit c4f041e

Please sign in to comment.