diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4c914fe..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,39 +0,0 @@
-*.pydevproject
-.metadata
-.gradle
-bin/
-build/
-tmp/
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.loadpath
-target/
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# CDT-specific
-.cproject
-
-# PDT-specific
-.buildpath
-
-# sbteclipse plugin
-.target
-
-# TeXlipse plugin
-.texlipse
-
-#Intellij
-.idea/
-*.impl
-
-# Generated files
-data/
-logs/
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..5fe7d7a
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+BlockServerTest
\ No newline at end of file
diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
new file mode 100644
index 0000000..5352bdf
--- /dev/null
+++ b/.idea/codeStyleSettings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..860f7c1
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/dictionaries/Exerosis.xml b/.idea/dictionaries/Exerosis.xml
new file mode 100644
index 0000000..5a925d8
--- /dev/null
+++ b/.idea/dictionaries/Exerosis.xml
@@ -0,0 +1,7 @@
+
+
+
+ enableable
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1c811aa
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ca29ae1
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 8186b37..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: java
-sudo: false
-
-jdk:
- - oraclejdk8
-
-install: mvn -version
-
-script:
- - mvn license:check package
-
-before_script:
- - cd $TRAVIS_BUILD_DIR
diff --git a/BlockServer.iml b/BlockServerTest.iml
similarity index 80%
rename from BlockServer.iml
rename to BlockServerTest.iml
index 4766edb..2ee29af 100644
--- a/BlockServer.iml
+++ b/BlockServerTest.iml
@@ -5,10 +5,11 @@
+
+
-
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 987e8e0..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,13 +0,0 @@
-BlockServer Contributing Guidelines
-===
-## Contributing code
-Please fork the repo and [create a pull request](https://github.com/BlockServerProject/BlockServer/pulls). Please note the following before you start writing code:
-* The code should follow the format at [Syntax.md](Syntax.md).
-* If you are adding new features, please make sure we want it in our repo currently. If you find it [here](https://github.com/BlockServerProject/BlockServer/issues/112), you can start working on it (if nobody else is assigned for that task).
-
-## Creating issues
-Issues must only be issues, not questions or support request. Please contact us on [IRC channel #blockserverproject](https://kiwiirc.com/client/chat.freenode.net/?nick=bsguest|?#blockserverproject) if you are having trouble setting up the server.
-
-If you are facing an issue that nobody else is facing, you are most likely doing wrong. Contact us on [IRC channel #blockserverproject](https://kiwiirc.com/client/chat.freenode.net/?nick=bsguest|?#blockserverproject) for support.
-
-Please provide enough information for us to debug. We would like to know how that bug happened and your system information. Please mention them in the issue.
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 02bbb60..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 719bb27..0000000
--- a/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-BlockServer [](https://travis-ci.org/BlockServerProject/BlockServer)
-===========
-BlockServer is an open source platform for Minecraft server software. It is very extensible and open source. This repository contains the core which is needed to run and load the extra modules which allow players to connect to the server.
-
-The BlockServer Project develops modules to support both PC and PE connections. Currently PC is lower priority as our goal is to support PE first.
diff --git a/Syntax.md b/Syntax.md
deleted file mode 100644
index e70a83e..0000000
--- a/Syntax.md
+++ /dev/null
@@ -1,66 +0,0 @@
-Syntax of BlockServer (Java)
-===
-* Indents should be in tabs.
-* Open braces for block expressions (e.g. methods, classes, if-blocks, for-blocks, etc.) should not occupy an independent line.
-* There can be an empty line between methods and/or fields.
-* There can be an empty line between two different sections of code.
-* Packages must be of or of subpackages of `org.blockserver`.
-* The three main code sections in a file (package, import, class/interface/enum declaration) should be separated with empty lines.
-* Imports of Java classes and custom classes can have an empty line between.
-* Do not make redundant imports like `java.lang.*` imports and unused imports.
-* Use Lombok for Getters and Setters
-* Use the Apache Logger library to print out text to console, with the following exceptions:
- * It is for debug purposes and will not affect user interface.
- * The server or the logger is not initialized.
-* Constructors, as a good practice, should point to the same `this(...)` constructor in order to avoid bugs.
-* Do not add redundant `this.` tokens unless necessary.
-* Add the `@Override` and `@SuppressWarnings(...)` annotations if required.
-* Unless name duplicated, do not fully qualify class names in class/interface/enum body.
-
-Example code:
-
-```java
-package org.blockserver.examples;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import net.blockserver.Server;
-
-@SuppressWarnings("serial")
-class ExampleException extends Exception{
- private String ext;
-
- public ExampleException(){
- this("Hello world!");
- }
- public ExampleException(String message){
- this(message, "log");
- }
- public ExampleException(String message, String ext){
- super(message);
- this.ext = ext;
- }
-
- public FilenameFilter getFilter(Pattern pattern){
- return new Foo(pattern);
- }
-
- private class Foo implements FilenameFilter{
- private Pattern pattern;
-
- public Foo(Pattern pattern){
- this.pattern = pattern;
- }
-
- @Override
- public boolean accept(File dir, String name){
- return pattern.bar(ext);
- }
- }
-
- public abstract static class Pattern extends com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern{
- public abstract boolean bar(String ext);
- }
-}
-```
diff --git a/license-definitions.xml b/license-definitions.xml
deleted file mode 100644
index 170cedc..0000000
--- a/license-definitions.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- /*
- *
- */
-
-
- (\s|\t)*/\*.*$
- .*\*/(\s|\t)*$
- false
- true
- false
-
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 3ddab06..27b4745 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,111 +1,12 @@
-
-
+
4.0.0
- org.blockserver
- BlockServer
- 1.0.0-BETA-SNAPSHOT
- jar
-
-
-
- snapshot-repo
- https://raw.githubusercontent.com/BlockServerProject/MavenRepository/master/snapshots
-
-
-
-
-
- snapshot-repo
- https://raw.githubusercontent.com/BlockServerProject/MavenRepository/master/snapshots
-
-
-
-
-
- org.projectlombok
- lombok
- 1.16.6
- provided
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.1
-
- 1.8
- 1.8
-
-
-
- com.mycila
- license-maven-plugin
- 2.11
-
- com/mycila/maven/plugin/license/templates/LGPL-3.txt
+ BlockServerTest
+ org.blockserver.test
+ 1.0.0
-
- license-definitions.xml
-
-
- src/main/java/**
- src/test/java/**
- pom.xml
-
-
-
-
-
- check
-
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 2.3
-
-
-
- package
-
- shade
-
-
-
-
-
- org.blockserver.core.run
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/main/BlockServer.iml b/src/main/BlockServer.iml
deleted file mode 100644
index 7f09f9c..0000000
--- a/src/main/BlockServer.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/Server.java b/src/main/java/org/blockserver/core/Server.java
deleted file mode 100644
index 54c16ee..0000000
--- a/src/main/java/org/blockserver/core/Server.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.event.EventManager;
-import org.blockserver.core.events.modules.ModuleDisableEvent;
-import org.blockserver.core.events.modules.ModuleEnableEvent;
-import org.blockserver.core.module.EnableableImplementation;
-import org.blockserver.core.module.ModuleLoader;
-import org.blockserver.core.module.ServerModule;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Represents the core server implementation.
- *
- * @author BlockServer Team
- */
-public class Server implements EnableableImplementation {
- //TODO Add YAML utils somewhere!!
- //Modules
- private final Map, ServerModule> modules = new HashMap<>();
- @Getter @Setter private EventManager eventManager = new EventManager();
-
- public Server(ModuleLoader... moduleLoaders) {
- for (ModuleLoader moduleLoader : moduleLoaders) {
- moduleLoader.setModules(modules, this);
- }
- }
-
- @SuppressWarnings("unchecked")
- public T getModule(Class moduleClass) {
- return (T) modules.get(moduleClass);
- }
-
- public void addModule(ServerModule module) {
- modules.put(module.getClass(), module);
- }
-
- @Override
- public void enable() {
- modules.values().forEach((module) -> {
- if (module.isEnabled())
- return;
- eventManager.fire(new ModuleEnableEvent(this, module), event -> {
- if (!event.isCancelled())
- module.enable();
- });
- });
- EnableableImplementation.super.enable();
- }
-
- @Override
- public void disable() {
- modules.values().forEach((module) -> {
- if (!module.isEnabled())
- return;
- eventManager.fire(new ModuleDisableEvent(this, module), event -> {
- if (!event.isCancelled())
- module.disable();
- });
- });
- EnableableImplementation.super.disable();
- }
-
- public Map, ServerModule> getModules() {
- return Collections.unmodifiableMap(modules);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/Cancellable.java b/src/main/java/org/blockserver/core/event/Cancellable.java
deleted file mode 100644
index 8c7ffa9..0000000
--- a/src/main/java/org/blockserver/core/event/Cancellable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-/**
- * Written by Exerosis!
- */
-public interface Cancellable {
- boolean isCancelled();
-
- void setCancelled(boolean cancelled);
-}
diff --git a/src/main/java/org/blockserver/core/event/CancellableImplementation.java b/src/main/java/org/blockserver/core/event/CancellableImplementation.java
deleted file mode 100644
index fbc5f74..0000000
--- a/src/main/java/org/blockserver/core/event/CancellableImplementation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-public interface CancellableImplementation extends Cancellable {
- Map instances = new WeakHashMap<>();
-
- @Override
- default boolean isCancelled() {
- return instances.getOrDefault(this, false);
- }
-
- @Override
- default void setCancelled(boolean cancelled) {
- instances.put(this, cancelled);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/EventExecutor.java b/src/main/java/org/blockserver/core/event/EventExecutor.java
deleted file mode 100644
index 16ca3f6..0000000
--- a/src/main/java/org/blockserver/core/event/EventExecutor.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-public interface EventExecutor {
- void execute(T event);
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/EventListener.java b/src/main/java/org/blockserver/core/event/EventListener.java
deleted file mode 100644
index ba18652..0000000
--- a/src/main/java/org/blockserver/core/event/EventListener.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-
-public class EventListener {
- private Class _listenerType;
- private Priority _priority = Priority.NORMAL;
- private boolean _post;
-
- public Class getListenerType() {
- return _listenerType;
- }
-
- public boolean isPost() {
- return _post;
- }
-
- public Priority getPriority() {
- return _priority;
- }
-
- public void onEvent(B event) {
- }
-
- public EventListener post() {
- _post = !_post;
- return this;
- }
-
- public EventListener priority(Priority priority) {
- _priority = priority;
- return this;
- }
-
- public EventListener register(Class listenerType, EventManager eventManager) {
- _listenerType = listenerType;
- eventManager.registerListener(this);
- return this;
- }
-
- public void unregister(EventManager eventManager) {
- eventManager.unregisterListener(this);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/EventManager.java b/src/main/java/org/blockserver/core/event/EventManager.java
deleted file mode 100644
index 7a32c15..0000000
--- a/src/main/java/org/blockserver/core/event/EventManager.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-
-import java.util.Set;
-import java.util.TreeSet;
-
-public class EventManager {
- private Set> instances = new TreeSet<>((o1, o2) -> Integer.compare(o2.getPriority().ordinal(), o1.getPriority().ordinal()));
-
- public EventManager() {
- }
-
- public void registerListener(EventListener, ?> listener) {
- instances.add(listener);
- }
-
- public void unregisterListener(EventListener listener) {
- instances.remove(listener);
- }
-
- @SuppressWarnings("unchecked")
- public B fire(Class listenerType, B event, EventExecutor executor) {
- instances.stream().filter(l -> l.getListenerType().isAssignableFrom(listenerType)).forEach(l -> {
- EventListener listener = (EventListener) l;
- if (listener.isPost())
- listener.onEvent(event);
- else {
- if (executor != null)
- executor.execute(event);
- listener.onEvent(event);
- }
- });
- return event;
- }
-
- public B fire(B event, EventExecutor executor) {
- return fire(event.getClass(), event, executor);
- }
-
- public B fire(Class listenerType, B event) {
- return fire(listenerType, event, null);
- }
-
- public B fire(B event) {
- return fire(event.getClass(), event, null);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/MessageEventListener.java b/src/main/java/org/blockserver/core/event/MessageEventListener.java
deleted file mode 100644
index 24076dc..0000000
--- a/src/main/java/org/blockserver/core/event/MessageEventListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.events.messages.MessageEvent;
-import org.blockserver.core.modules.message.Message;
-
-/**
- * Written by Exerosis!
- */
-public class MessageEventListener extends EventListener> {
- public MessageEventListener register(Class listenerType, Server server) {
- return (MessageEventListener) register(listenerType, server.getEventManager());
- }
-
- public void unregister(Server server) {
- unregister(server.getEventManager());
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/Priority.java b/src/main/java/org/blockserver/core/event/Priority.java
deleted file mode 100644
index 3447bdb..0000000
--- a/src/main/java/org/blockserver/core/event/Priority.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-public enum Priority {
-
- LOWEST(0), LOW(1), NORMAL(2), HIGH(3), HIGHEST(4), INTERNAL(5);
-
- private final int slot;
-
- Priority(int slot) {
- this.slot = slot;
- }
-
- public int getSlot() {
- return this.slot;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/event/ServerEventListener.java b/src/main/java/org/blockserver/core/event/ServerEventListener.java
deleted file mode 100644
index 62b7665..0000000
--- a/src/main/java/org/blockserver/core/event/ServerEventListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.event;
-
-import org.blockserver.core.Server;
-
-/**
- * Written by Exerosis!
- */
-public class ServerEventListener extends EventListener {
- public void register(Class listenerType, Server server) {
- register(listenerType, server.getEventManager());
- }
-
- public void unregister(Server server) {
- unregister(server.getEventManager());
- }
-
- public ServerEventListener post() {
- super.post();
- return this;
- }
-
- public ServerEventListener priority(Priority priority) {
- super.priority(priority);
- return this;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/ServerEvent.java b/src/main/java/org/blockserver/core/events/ServerEvent.java
deleted file mode 100644
index 0aa7337..0000000
--- a/src/main/java/org/blockserver/core/events/ServerEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.Server;
-
-public class ServerEvent {
- @Getter @Setter private Server server;
-
- public ServerEvent(Server server) {
- this.server = server;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/messages/MessageEvent.java b/src/main/java/org/blockserver/core/events/messages/MessageEvent.java
deleted file mode 100644
index e735b83..0000000
--- a/src/main/java/org/blockserver/core/events/messages/MessageEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.messages;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.event.CancellableImplementation;
-import org.blockserver.core.modules.message.Message;
-
-/**
- * Written by Exerosis!
- */
-public class MessageEvent implements CancellableImplementation {
- @Getter @Setter private T message;
-
- public MessageEvent(T message) {
- this.message = message;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/messages/MessageReceiveEvent.java b/src/main/java/org/blockserver/core/events/messages/MessageReceiveEvent.java
deleted file mode 100644
index 209dc74..0000000
--- a/src/main/java/org/blockserver/core/events/messages/MessageReceiveEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.messages;
-
-import org.blockserver.core.modules.message.Message;
-
-public class MessageReceiveEvent extends MessageEvent {
- public MessageReceiveEvent(T message) {
- super(message);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/messages/MessageSendEvent.java b/src/main/java/org/blockserver/core/events/messages/MessageSendEvent.java
deleted file mode 100644
index 42fbe4b..0000000
--- a/src/main/java/org/blockserver/core/events/messages/MessageSendEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.messages;
-
-import org.blockserver.core.modules.message.Message;
-
-public class MessageSendEvent extends MessageEvent {
- public MessageSendEvent(T message) {
- super(message);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/modules/ModuleDisableEvent.java b/src/main/java/org/blockserver/core/events/modules/ModuleDisableEvent.java
deleted file mode 100644
index 6998ba4..0000000
--- a/src/main/java/org/blockserver/core/events/modules/ModuleDisableEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.modules;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-
-public class ModuleDisableEvent extends ModuleEvent {
- public ModuleDisableEvent(Server server, ServerModule module) {
- super(server, module);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/modules/ModuleEnableEvent.java b/src/main/java/org/blockserver/core/events/modules/ModuleEnableEvent.java
deleted file mode 100644
index 6074c6a..0000000
--- a/src/main/java/org/blockserver/core/events/modules/ModuleEnableEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.modules;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-
-public class ModuleEnableEvent extends ModuleEvent {
- public ModuleEnableEvent(Server server, ServerModule module) {
- super(server, module);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/modules/ModuleEvent.java b/src/main/java/org/blockserver/core/events/modules/ModuleEvent.java
deleted file mode 100644
index 4d32fee..0000000
--- a/src/main/java/org/blockserver/core/events/modules/ModuleEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.modules;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.Server;
-import org.blockserver.core.event.CancellableImplementation;
-import org.blockserver.core.events.ServerEvent;
-import org.blockserver.core.module.ServerModule;
-
-public class ModuleEvent extends ServerEvent implements CancellableImplementation {
- @Getter @Setter private ServerModule module;
-
- public ModuleEvent(Server server, ServerModule module) {
- super(server);
- this.module = module;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/packets/PacketEvent.java b/src/main/java/org/blockserver/core/events/packets/PacketEvent.java
deleted file mode 100644
index 581c8f3..0000000
--- a/src/main/java/org/blockserver/core/events/packets/PacketEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.packets;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.event.CancellableImplementation;
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-/**
- * Written by Exerosis!
- */
-public class PacketEvent implements CancellableImplementation {
- @Getter @Setter private RawPacket packet;
-
- public PacketEvent(RawPacket packet) {
- this.packet = packet;
- }
-}
diff --git a/src/main/java/org/blockserver/core/events/packets/PacketReceiveEvent.java b/src/main/java/org/blockserver/core/events/packets/PacketReceiveEvent.java
deleted file mode 100644
index fd13543..0000000
--- a/src/main/java/org/blockserver/core/events/packets/PacketReceiveEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.packets;
-
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-/**
- * Written by Exerosis!
- */
-public class PacketReceiveEvent extends PacketEvent {
- public PacketReceiveEvent(RawPacket packet) {
- super(packet);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/events/packets/PacketSendEvent.java b/src/main/java/org/blockserver/core/events/packets/PacketSendEvent.java
deleted file mode 100644
index 5e92b1c..0000000
--- a/src/main/java/org/blockserver/core/events/packets/PacketSendEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.events.packets;
-
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-/**
- * Written by Exerosis!
- */
-public class PacketSendEvent extends PacketEvent {
- public PacketSendEvent(RawPacket packet) {
- super(packet);
- }
-}
diff --git a/src/main/java/org/blockserver/core/exceptions/BlockServerException.java b/src/main/java/org/blockserver/core/exceptions/BlockServerException.java
deleted file mode 100644
index 3eb49aa..0000000
--- a/src/main/java/org/blockserver/core/exceptions/BlockServerException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.exceptions;
-
-import org.blockserver.core.exceptions.node.ExceptionBuilder;
-
-public class BlockServerException extends RuntimeException {
- public BlockServerException(String message) {
- super(message);
- }
-
- public BlockServerException(ExceptionBuilder factory) {
- super(factory.toString());
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/exceptions/node/ExceptionBuilder.java b/src/main/java/org/blockserver/core/exceptions/node/ExceptionBuilder.java
deleted file mode 100644
index 8a6797f..0000000
--- a/src/main/java/org/blockserver/core/exceptions/node/ExceptionBuilder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.exceptions.node;
-
-public class ExceptionBuilder {
- private StringBuilder builder = new StringBuilder("\t");
-
- public ExceptionBuilder(String name, ExceptionNode... nodes) {
- builder.append(name);
- for (ExceptionNode node : nodes)
- appendNode(node);
- }
-
- public ExceptionBuilder appendNode(ExceptionNode node) {
- if (node == null)
- return this;
- builder.append("\n\t");
- builder.append(node.getName());
- builder.append(": '");
- builder.append(node.getValue());
- builder.append('\'');
- return this;
- }
-
- @Override
- public String toString() {
- return builder.toString();
- }
-}
diff --git a/src/main/java/org/blockserver/core/exceptions/node/ExceptionNode.java b/src/main/java/org/blockserver/core/exceptions/node/ExceptionNode.java
deleted file mode 100644
index ae0a924..0000000
--- a/src/main/java/org/blockserver/core/exceptions/node/ExceptionNode.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.exceptions.node;
-
-public class ExceptionNode {
- private String name = "";
- private Object value;
-
- public ExceptionNode(String name, Object value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public Object getValue() {
- return value;
- }
-}
diff --git a/src/main/java/org/blockserver/core/module/Enableable.java b/src/main/java/org/blockserver/core/module/Enableable.java
deleted file mode 100644
index ace3ec5..0000000
--- a/src/main/java/org/blockserver/core/module/Enableable.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- */
-public interface Enableable {
- void enable();
-
- boolean isEnabled();
-
- void disable();
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/module/EnableableImplementation.java b/src/main/java/org/blockserver/core/module/EnableableImplementation.java
deleted file mode 100644
index c10a6d8..0000000
--- a/src/main/java/org/blockserver/core/module/EnableableImplementation.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * @author BlockServer Team
- * @see org.blockserver.core.module.Enableable
- */
-public interface EnableableImplementation extends Enableable {
- Map instances = new WeakHashMap<>();
-
- @Override
- default void enable() {
- instances.put(this, true);
- }
-
- @Override
- default boolean isEnabled() {
- return instances.getOrDefault(this, false);
- }
-
- @Override
- default void disable() {
- instances.put(this, false);
- }
-}
diff --git a/src/main/java/org/blockserver/core/module/Module.java b/src/main/java/org/blockserver/core/module/Module.java
deleted file mode 100644
index 6b4f548..0000000
--- a/src/main/java/org/blockserver/core/module/Module.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module;
-
-/**
- * Created by Exerosis.
- */
-public interface Module extends EnableableImplementation {
-}
diff --git a/src/main/java/org/blockserver/core/module/ModuleLoader.java b/src/main/java/org/blockserver/core/module/ModuleLoader.java
deleted file mode 100644
index d31bea4..0000000
--- a/src/main/java/org/blockserver/core/module/ModuleLoader.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module;
-
-import org.blockserver.core.Server;
-
-import java.util.Map;
-
-/**
- * @author BlockServer Team
- * @see org.blockserver.core.module.loaders
- */
-public interface ModuleLoader {
- void setModules(Map, ServerModule> modules, Server server);
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/module/ServerModule.java b/src/main/java/org/blockserver/core/module/ServerModule.java
deleted file mode 100644
index 8a8922e..0000000
--- a/src/main/java/org/blockserver/core/module/ServerModule.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module;
-
-import lombok.Getter;
-import org.blockserver.core.Server;
-
-/**
- * Base class for all modules. New modules should implement this class.
- *
- * @author BlockServer Team
- * @see org.blockserver.core.modules
- * @see org.blockserver.core.module.EnableableImplementation
- */
-public class ServerModule implements Module {
- @Getter private final Server server;
-
- public ServerModule(Server server) {
- this.server = server;
- }
-
- @Override
- public String toString() {
- return "[" + server.toString() + "] " + getClass().getSimpleName();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/module/loaders/CoreModuleLoader.java b/src/main/java/org/blockserver/core/module/loaders/CoreModuleLoader.java
deleted file mode 100644
index 5c91ba7..0000000
--- a/src/main/java/org/blockserver/core/module/loaders/CoreModuleLoader.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module.loaders;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ModuleLoader;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.config.ConfigModule;
-import org.blockserver.core.modules.file.FileModule;
-import org.blockserver.core.modules.logging.LoggingModule;
-import org.blockserver.core.modules.network.NetworkModule;
-import org.blockserver.core.modules.player.PlayerModule;
-import org.blockserver.core.modules.scheduler.SchedulerModule;
-import org.blockserver.core.modules.thread.ExecutorModule;
-
-import java.util.Map;
-
-/**
- * @author BlockServer Team
- * @see org.blockserver.core.module.ModuleLoader
- */
-public class CoreModuleLoader implements ModuleLoader {
-
- @Override
- public void setModules(Map, ServerModule> modules, Server server) {
- int start = modules.size();
-
- //Logging Module
- LoggingModule loggingModule = new LoggingModule(server);
- loggingModule.info("[CoreModuleLoader]: LoggingModule online, continuing load with logging capabilities!");
-
- //No Depends
- FileModule fileModule = new FileModule(server);
- PlayerModule playerModule = new PlayerModule(server);
- NetworkModule networkModule = new NetworkModule(server);
-
- //Single Module Depends
- ConfigModule configModule = new ConfigModule(server, fileModule);
- ExecutorModule executorModule = new ExecutorModule(server, configModule);
- SchedulerModule schedulerModule = new SchedulerModule(server, executorModule);
-
- //Multiple Module Depends
-
-
- //Module Adds
- //No Depends
- modules.put(fileModule.getClass(), fileModule);
- modules.put(loggingModule.getClass(), loggingModule);
- modules.put(networkModule.getClass(), networkModule);
- modules.put(playerModule.getClass(), playerModule);
-
- //Single Module Depends
- modules.put(configModule.getClass(), configModule);
- modules.put(executorModule.getClass(), executorModule);
- modules.put(schedulerModule.getClass(), schedulerModule);
-
- loggingModule.info("[CoreModuleLoader]: Loaded " + (modules.size() - start) + " core modules.");
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/module/loaders/JarModuleLoader.java b/src/main/java/org/blockserver/core/module/loaders/JarModuleLoader.java
deleted file mode 100644
index 5a24afd..0000000
--- a/src/main/java/org/blockserver/core/module/loaders/JarModuleLoader.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.module.loaders;
-
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ModuleLoader;
-import org.blockserver.core.module.ServerModule;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Map;
-import java.util.Properties;
-import java.util.jar.JarFile;
-
-/**
- * ServerModule Loader that can load modules from JARs
- *
- * @author BlockServer Team
- * @see org.blockserver.core.module.ModuleLoader
- */
-public class JarModuleLoader implements ModuleLoader {
- @SuppressWarnings({"unchecked", "deprecation"})
- @Override
- public void setModules(Map, ServerModule> modules, Server server) {
- File moduleFolder = new File("Modules");
- if (moduleFolder.mkdirs())
- System.err.println("Could not find modules folder, created modules folder!");
- File[] files = moduleFolder.listFiles();
- System.err.println(files.length);
- if (files == null || files.length <= 0)
- return;
-
- for (File file : files) {
- System.err.println(file.getName());
- if (file.getName().endsWith(".jar")) {
- try {
- JarFile jar = new JarFile(file);
- Properties jarProp = getJarProperties(jar);
- URLClassLoader loader = new URLClassLoader(new URL[]{file.toURL()});
- String className = jarProp.getProperty("mainClass", "default");
- try {
- Class clazz = loader.loadClass(className);
- try {
- ServerModule module = (ServerModule) clazz.getConstructor(Server.class).newInstance(server);
- modules.put(module.getClass(), module);
- System.out.println("[ServerModule Loader]: Loaded " + file.getName());
- } catch (ClassCastException e) {
- System.err.println("[ServerModule Loader]: Failed to load main class for " + file.getName() + ": main class does not extend ServerModule.");
- } catch (NoSuchMethodException | InvocationTargetException e) {
- System.err.println("[ServerModule Loader]: Failed to load main class for " + file.getName() + ": " + e.getClass().getSimpleName() + " -> " + e.getMessage());
- }
- } catch (ClassNotFoundException e) {
- if (className.equals("default")) {
- System.err.println("[ServerModule Loader]: Failed to load main class for " + file.getName() + ": main class not specified.");
- }
- System.err.println("[ServerModule Loader]: Failed to load main class for " + file.getName() + ": ClassNotFoundException -> " + e.getMessage());
- } catch (InstantiationException | IllegalAccessException e) {
- System.err.println("[ServerModule Loader]: Failed to load main class for " + file.getName() + ": " + e.getClass().getSimpleName() + " -> " + e.getMessage());
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- private Properties getJarProperties(JarFile jar) throws IOException {
- InputStream stream = jar.getInputStream(jar.getJarEntry("module.properties"));
- Properties p = new Properties();
- p.load(stream);
- return p;
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/config/ConfigModule.java b/src/main/java/org/blockserver/core/modules/config/ConfigModule.java
deleted file mode 100644
index 99102f4..0000000
--- a/src/main/java/org/blockserver/core/modules/config/ConfigModule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.config;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.file.FileModule;
-
-/**
- * Created by Exerosis.
- */
-public class ConfigModule extends ServerModule {
- private final FileModule fileModule;
-
- public ConfigModule(Server server, FileModule fileModule) {
- super(server);
- this.fileModule = fileModule;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/entity/Entity.java b/src/main/java/org/blockserver/core/modules/entity/Entity.java
deleted file mode 100644
index cca43c3..0000000
--- a/src/main/java/org/blockserver/core/modules/entity/Entity.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.entity;
-
-import org.blockserver.core.modules.world.positions.Location;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- */
-public class Entity {
- private final Map, EntityModule> modules = new HashMap<>();
- private float x;
- private float y;
- private float z;
-
- //TODO deal with locations and what not!!
- public Entity(float x, float y, float z) {
- this.x = x;
- this.y = y;
- this.z = z;
- modules.values().forEach(EntityModule::enable);
- }
-
- public Entity(Location location) {
- this(location.getX(), location.getY(), location.getZ());
- }
-
-
- public void addModule(EntityModule module) {
- modules.put(module.getClass(), module);
- }
-
- public void removeModule(Class extends EntityModule> moduleClass) {
- modules.remove(moduleClass);
- }
-
- public void removeModule(EntityModule module) {
- removeModule(module.getClass());
- }
-
- public EntityModule getModule(Class extends EntityModule> moduleClass) {
- return modules.get(moduleClass);
- }
-
- public void destroy() {
- modules.values().forEach(EntityModule::disable);
- }
-
-
- public Map, EntityModule> getModules() {
- return Collections.unmodifiableMap(modules);
- }
-
- public Location getLocation() {
- return new Location(x, y, z);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/entity/EntityModule.java b/src/main/java/org/blockserver/core/modules/entity/EntityModule.java
deleted file mode 100644
index 43427a8..0000000
--- a/src/main/java/org/blockserver/core/modules/entity/EntityModule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.entity;
-
-import lombok.Getter;
-import org.blockserver.core.module.Module;
-
-/**
- * Created by Exerosis.
- */
-public class EntityModule implements Module {
- @Getter private final Entity entity;
-
- public EntityModule(Entity entity) {
- this.entity = entity;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/entity/entities/ExampleEntity.java b/src/main/java/org/blockserver/core/modules/entity/entities/ExampleEntity.java
deleted file mode 100644
index 32a02fc..0000000
--- a/src/main/java/org/blockserver/core/modules/entity/entities/ExampleEntity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.entity.entities;
-
-import org.blockserver.core.modules.entity.Entity;
-import org.blockserver.core.modules.entity.modules.ExampleEntityModule;
-import org.blockserver.core.modules.world.positions.Location;
-
-/**
- * Created by Exerosis.
- */
-public class ExampleEntity extends Entity {
- public ExampleEntity(Location location) {
- super(location);
- }
-
- public ExampleEntity(float x, float y, float z) {
- super(x, y, z);
- addModule(new ExampleEntityModule(this));
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/entity/modules/ExampleEntityModule.java b/src/main/java/org/blockserver/core/modules/entity/modules/ExampleEntityModule.java
deleted file mode 100644
index 66bd368..0000000
--- a/src/main/java/org/blockserver/core/modules/entity/modules/ExampleEntityModule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.entity.modules;
-
-import org.blockserver.core.modules.entity.Entity;
-import org.blockserver.core.modules.entity.EntityModule;
-
-/**
- * Created by Exerosis.
- */
-public class ExampleEntityModule extends EntityModule {
- public ExampleEntityModule(Entity entity) {
- super(entity);
- }
-
- @Override
- public void enable() {
- super.enable();
- }
-
- @Override
- public void disable() {
- super.disable();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/file/FileModule.java b/src/main/java/org/blockserver/core/modules/file/FileModule.java
deleted file mode 100644
index ea43578..0000000
--- a/src/main/java/org/blockserver/core/modules/file/FileModule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.file;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-
-/**
- * Created by Exerosis.
- */
-public class FileModule extends ServerModule {
- public FileModule(Server server) {
- super(server);
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/logging/LoggingModule.java b/src/main/java/org/blockserver/core/modules/logging/LoggingModule.java
deleted file mode 100644
index af1fcf5..0000000
--- a/src/main/java/org/blockserver/core/modules/logging/LoggingModule.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.logging;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-
-/**
- * Logging ServerModule with different log levels. (debug, info, warn, error)
- * TODO: Implement SLF4j and/or log4j2
- *
- * @author BlockServer Team
- * @see ServerModule
- */
-public class LoggingModule extends ServerModule {
-
- public LoggingModule(Server server) {
- super(server);
- }
-
- public void debug(String message) {
- System.out.println("[DEBUG]: " + message);
- }
-
- public void info(String message) {
- System.out.println("[INFO]: " + message);
- }
-
- public void warn(String message) {
- System.out.println("[WARN]: " + message);
- }
-
- public void error(String message) {
- System.err.println("[ERROR]: " + message);
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/message/Message.java b/src/main/java/org/blockserver/core/modules/message/Message.java
deleted file mode 100644
index 4a86642..0000000
--- a/src/main/java/org/blockserver/core/modules/message/Message.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.message;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.modules.player.Player;
-
-/**
- * Written by Exerosis!
- */
-public class Message {
- @Getter final private boolean async;
- @Getter @Setter private Player player;
-
- public Message(Player player) {
- this.player = player;
- async = false;
- }
-
- public Message(Player player, boolean async) {
- this.player = player;
- this.async = async;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/message/MessageModule.java b/src/main/java/org/blockserver/core/modules/message/MessageModule.java
deleted file mode 100644
index 8a164bb..0000000
--- a/src/main/java/org/blockserver/core/modules/message/MessageModule.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.message;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.event.Priority;
-import org.blockserver.core.event.ServerEventListener;
-import org.blockserver.core.events.messages.MessageReceiveEvent;
-import org.blockserver.core.events.messages.MessageSendEvent;
-import org.blockserver.core.modules.network.NetworkConverter;
-import org.blockserver.core.modules.network.pipeline.NetworkPipelineHandler;
-import org.blockserver.core.modules.network.pipeline.PipelineDispatcher;
-import org.blockserver.core.modules.network.pipeline.PipelineProviderImplementation;
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-import org.blockserver.core.modules.thread.ExecutorModule;
-
-public class MessageModule extends PipelineProviderImplementation implements PipelineDispatcher {
- private final ServerEventListener listener;
- private final ExecutorModule executorModule;
- private final NetworkConverter converter;
-
- public MessageModule(Server server, ExecutorModule executorModule, NetworkPipelineHandler handler, NetworkConverter converter) {
- super(server, handler);
- this.executorModule = executorModule;
- this.converter = converter;
- listener = new ServerEventListener() {
- @Override
- public void onEvent(MessageSendEvent event) {
- if (!event.isCancelled())
- provide(converter.toPacket(event.getMessage()));
- }
- }.priority(Priority.INTERNAL).post();
- }
-
- @Override
- public void enable() {
- listener.register(MessageSendEvent.class, getServer());
- super.enable();
- }
-
- @Override
- public void disable() {
- listener.unregister(getServer());
- super.disable();
- }
-
- @Override
- public void dispatch(RawPacket packet) {
- executorModule.getExecutorService().execute(() -> getServer().getEventManager().fire(new MessageReceiveEvent<>(converter.toMessage(packet))));
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/message/messages/PlayerLoginMessage.java b/src/main/java/org/blockserver/core/modules/message/messages/PlayerLoginMessage.java
deleted file mode 100644
index 06ddec8..0000000
--- a/src/main/java/org/blockserver/core/modules/message/messages/PlayerLoginMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.message.messages;
-
-import org.blockserver.core.modules.message.Message;
-import org.blockserver.core.modules.player.Player;
-import org.blockserver.core.utilities.Skin;
-
-import java.util.UUID;
-
-/**
- * Written by Exerosis!
- */
-public class PlayerLoginMessage extends Message {
- public long clientID;
- public String username;
- public UUID uuid;
- public Skin skin;
-
- public PlayerLoginMessage(Player player) {
- super(player);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/message/messages/block/MessageOutBlockChange.java b/src/main/java/org/blockserver/core/modules/message/messages/block/MessageOutBlockChange.java
deleted file mode 100644
index 76c4117..0000000
--- a/src/main/java/org/blockserver/core/modules/message/messages/block/MessageOutBlockChange.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.message.messages.block;
-
-import org.blockserver.core.modules.message.Message;
-import org.blockserver.core.modules.player.Player;
-import org.blockserver.core.modules.world.Block;
-
-/**
- * Written by Exerosis!
- */
-public class MessageOutBlockChange extends Message {
- public MessageOutBlockChange(Player player, Block... blocks) {
- super(player);
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/network/NetworkConverter.java b/src/main/java/org/blockserver/core/modules/network/NetworkConverter.java
deleted file mode 100644
index 56194e0..0000000
--- a/src/main/java/org/blockserver/core/modules/network/NetworkConverter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network;
-
-
-import org.blockserver.core.modules.message.Message;
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-/**
- * Written by Exerosis!
- */
-public interface NetworkConverter {
- RawPacket toPacket(Message message);
-
- Message toMessage(RawPacket packet);
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/network/NetworkModule.java b/src/main/java/org/blockserver/core/modules/network/NetworkModule.java
deleted file mode 100644
index 15bfd87..0000000
--- a/src/main/java/org/blockserver/core/modules/network/NetworkModule.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network;
-
-import lombok.Getter;
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.network.pipeline.NetworkPipelineHandler;
-
-/**
- * Created by Exerosis.
- */
-public class NetworkModule extends ServerModule {
- @Getter private NetworkPipelineHandler inboundHandler = new NetworkPipelineHandler();
- @Getter private NetworkPipelineHandler outboundHandler = new NetworkPipelineHandler();
-
- public NetworkModule(Server server) {
- super(server);
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/network/PacketEventModule.java b/src/main/java/org/blockserver/core/modules/network/PacketEventModule.java
deleted file mode 100644
index d1ea4ce..0000000
--- a/src/main/java/org/blockserver/core/modules/network/PacketEventModule.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.event.Priority;
-import org.blockserver.core.event.ServerEventListener;
-import org.blockserver.core.events.packets.PacketReceiveEvent;
-import org.blockserver.core.events.packets.PacketSendEvent;
-import org.blockserver.core.modules.network.pipeline.NetworkPipelineHandler;
-import org.blockserver.core.modules.network.pipeline.PipelineDispatcher;
-import org.blockserver.core.modules.network.pipeline.PipelineProviderImplementation;
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-public class PacketEventModule extends PipelineProviderImplementation implements PipelineDispatcher {
- private final ServerEventListener listener;
-
- public PacketEventModule(NetworkPipelineHandler handler, Server server) {
- super(server, handler);
- listener = new ServerEventListener() {
- @Override
- public void onEvent(PacketSendEvent event) {
- if (!event.isCancelled())
- provide(event.getPacket());
- }
- }.priority(Priority.INTERNAL).post();
- }
-
- @Override
- public void enable() {
- listener.register(PacketSendEvent.class, getServer());
- super.enable();
- }
-
- @Override
- public void disable() {
- listener.unregister(getServer());
- super.disable();
- }
-
- @Override
- public void dispatch(RawPacket packet) {
- getServer().getEventManager().fire(new PacketReceiveEvent(packet));
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/network/pipeline/NetworkPipelineHandler.java b/src/main/java/org/blockserver/core/modules/network/pipeline/NetworkPipelineHandler.java
deleted file mode 100644
index c6efada..0000000
--- a/src/main/java/org/blockserver/core/modules/network/pipeline/NetworkPipelineHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network.pipeline;
-
-
-import lombok.Getter;
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-public class NetworkPipelineHandler {
- @Getter private final Set dispatchers = Collections.synchronizedSet(new HashSet<>());
-
- public NetworkPipelineHandler() {
-
- }
-
- public void provide(RawPacket packet) {
- for (PipelineDispatcher dispatcher : dispatchers) {
- dispatcher.dispatch(packet);
- }
- }
-
- public void unregisterDispatcher(PipelineDispatcher dispatcher) {
- dispatchers.remove(dispatcher);
- }
-
- public void registerDispatcher(PipelineDispatcher dispatcher) {
- dispatchers.add(dispatcher);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineDispatcher.java b/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineDispatcher.java
deleted file mode 100644
index d00377c..0000000
--- a/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineDispatcher.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network.pipeline;
-
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-/**
- * Written by Exerosis!
- */
-public interface PipelineDispatcher {
- void dispatch(RawPacket packet);
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineProvider.java b/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineProvider.java
deleted file mode 100644
index 61e86cf..0000000
--- a/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineProvider.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network.pipeline;
-
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-/**
- * Created by Exerosis.
- */
-public interface PipelineProvider {
- void provide(RawPacket packet);
-}
diff --git a/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineProviderImplementation.java b/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineProviderImplementation.java
deleted file mode 100644
index 0b1242c..0000000
--- a/src/main/java/org/blockserver/core/modules/network/pipeline/PipelineProviderImplementation.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network.pipeline;
-
-import lombok.Getter;
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.network.pipeline.packet.RawPacket;
-
-public class PipelineProviderImplementation extends ServerModule implements PipelineProvider {
- @Getter private final NetworkPipelineHandler handler;
-
- public PipelineProviderImplementation(Server server, NetworkPipelineHandler handler) {
- super(server);
- this.handler = handler;
- }
-
- @Override
- public void provide(RawPacket packet) {
- handler.provide(packet);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/network/pipeline/packet/BinaryBuffer.java b/src/main/java/org/blockserver/core/modules/network/pipeline/packet/BinaryBuffer.java
deleted file mode 100644
index 8557636..0000000
--- a/src/main/java/org/blockserver/core/modules/network/pipeline/packet/BinaryBuffer.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network.pipeline.packet;
-
-/*
-import net.redstonelamp.item.Item;
-import net.redstonelamp.utils.BinaryUtils;
-import org.spout.nbt.CompoundTag;
-*/
-
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.UUID;
-
-/**
- * An NIO buffer class to wrap around a java.nio.ByteBuffer.
- *
- * This buffer is dynamic, as it changes size when the allocated amount is too small.
- *
- * This class is originally from the RedstoneLamp Project. It has been modified from the original
- * which can be found at: https://github.com/RedstoneLamp/RedstoneLamp/blob/rewrite/src/main/java/net/redstonelamp/nio/BinaryBuffer.java
- *
- * @author RedstoneLamp Team and BlockServer Team
- */
-public class BinaryBuffer{
- private ByteBuffer bb;
-
- protected BinaryBuffer(ByteBuffer bb){
- this.bb = bb;
- }
-
- /**
- * Create a new DynamicByteBuffer wrapped around a byte array with the specified order
- *
- * @param bytes The byte array to be wrapped around
- * @param order The ByteOrder of the buffer, Big Endian or Little Endian.
- * @return A new DynamicByteBuffer class, at position zero wrapped around the byte array in the specified order
- */
- public static BinaryBuffer wrapBytes(byte[] bytes, ByteOrder order){
- ByteBuffer bb = ByteBuffer.wrap(bytes);
- bb.order(order);
- bb.position(0);
- return new BinaryBuffer(bb);
- }
-
- /**
- * Create a new DynamicByteBuffer with the specified initalSize and order
- *
- * The Buffer will grow if an attempt is to put more data than the initalSize
- *
- * @param initalSize The inital size of the buffer
- * @param order The ByteOrder of the buffer, Big Endian or Little Endian
- * @return A new DynamicByteBuffer class, at position zero with the specified order and initalSize
- */
- public static BinaryBuffer newInstance(int initalSize, ByteOrder order){
- ByteBuffer bb = ByteBuffer.allocate(initalSize);
- bb.order(order);
- bb.position(0);
- return new BinaryBuffer(bb);
- }
-
- /**
- * Get len of bytes from the buffer.
- *
- * @param len The length of bytes to get from the buffer
- * @return A byte array of len bytes
- * @throws java.nio.BufferUnderflowException If there is not enough bytes in the buffer to read
- */
- public byte[] get(int len){
- byte[] b = new byte[len];
- bb.get(b);
- return b;
- }
-
- /**
- * Put an amount of bytes into the buffer. The buffer will resize to fit the bytes if the buffer is too small.
- *
- * @param bytes The byte array to be put into the buffer
- */
- public void put(byte[] bytes){
- try{
- bb.put(bytes);
- }catch(BufferOverflowException e){
- setPosition(0);
- byte[] all = get(remaining());
- bb = ByteBuffer.allocate(all.length + bytes.length);
- bb.put(all);
- bb.put(bytes);
- }
- }
-
- /**
- * Get a single signed byte from the buffer
- *
- * @return A single unsigned byte
- */
- public byte getByte(){
- return bb.get();
- }
-
- /**
- * Get a single signed boolean from the buffer (one byte)
- *
- * @return A single boolean
- */
- public boolean getBoolean(){
- return bb.get() > 0;
- }
-
- /**
- * Get a single unsigned byte from the buffer
- *
- * @return A single unsigned byte
- */
- public short getUnsignedByte(){
- return (short) (bb.get() & 0xFF);
- }
-
- /**
- * Get a single signed short (2 bytes) from the buffer
- *
- * @return A single signed short
- */
- public short getShort(){
- return bb.getShort();
- }
-
- /**
- * Get a single unsigned short (2 bytes) from the buffer
- *
- * @return A single unsigned short
- */
- public short getUnsignedShort(){
- return (short) (bb.getShort() & 0xFFFF);
- }
-
- /**
- * Get a single signed integer (4 bytes) from the buffer
- *
- * @return A single signed integer
- */
- public int getInt(){
- return bb.getInt();
- }
-
- /**
- * Get a single singed long (8 bytes) from the buffer
- *
- * @return A single signed long
- */
- public long getLong(){
- return bb.getLong();
- }
-
- public float getFloat(){
- return bb.getFloat();
- }
-
- public double getDouble(){
- return bb.getDouble();
- }
-
- /**
- * Gets a Google Protocol Buffers VarInt from the buffer.
- * Code is from: https://gist.github.com/thinkofdeath/e975ddee04e9c87faf22
- *
- * @return The VarInt, as an integer.
- */
- public int getVarInt(){
- int size = 0;
- for(int i = 0; ; i += 7){
- byte tmp = getByte();
- if((tmp & 0x80) == 0 && (i != 4 * 7 || tmp < 1 << 3)){
- return size | tmp << i;
- }else if(i < 4 * 7){
- size |= (tmp & 0x7f) << i;
- }
- }
- }
-
- /**
- * Get a single short prefixed string from the buffer (2 + str bytes)
- *
- * @return A single short prefixed string
- */
- public String getString(){
- return new String(get(getUnsignedShort()));
- }
-
- /*
- public Item getSlot(){
- short id = getShort();
- if(id <= 0){
- return Item.get(0, (short) 0, 0);
- }
- int count = getByte();
- short data = getShort();
-
- int len = getUnsignedShort();
- if(len > 0){
- byte[] nbt = get(len);
-
- Item i = Item.get(id, data, count);
- if(i != null){
- i.setCompoundTag((CompoundTag) BinaryUtils.readNBTTag(nbt));
- }
- return i;
- }else{
- return Item.get(id, data, count);
- }
- }
- */
-
- /**
- * Get a single varint prefixed string from the buffer (varint bytes + str bytes)
- *
- * @return A single varint prefixed string
- */
- public String getVarString(){
- return new String(get(getVarInt()));
- }
-
- public UUID getUUID(){
- return new UUID(bb.getLong(), bb.getLong());
- }
-
- public void putByte(byte b){
- put(new byte[]{b});
- }
-
- public void putBoolean(boolean b){
- put(new byte[]{(byte) (b ? 1 : 0)});
- }
-
- public void putShort(short s){
- put(ByteBuffer.allocate(2).order(getOrder()).putShort(s).array());
- }
-
- public void putInt(int i){
- put(ByteBuffer.allocate(4).order(getOrder()).putInt(i).array());
- }
-
- public void putLong(long l){
- put(ByteBuffer.allocate(8).order(getOrder()).putLong(l).array());
- }
-
- public void putFloat(float f){
- put(ByteBuffer.allocate(4).order(getOrder()).putFloat(f).array());
- }
-
- public void putDouble(double d){
- put(ByteBuffer.allocate(8).order(getOrder()).putDouble(d).array());
- }
-
- public void putString(String s){
- putShort((short) s.getBytes().length);
- put(s.getBytes());
- }
-
- public void putVarString(String s){
- putVarInt(s.getBytes().length);
- put(s.getBytes());
- }
-
- public void putUUID(UUID uuid){
- putLong(uuid.getMostSignificantBits());
- putLong(uuid.getLeastSignificantBits());
- }
-
- /*
- public void putSlot(Item item){
- if(item.getId() == 0){
- putShort((short) 0);
- return;
- }
- putShort((short) item.getId());
- putByte((byte) item.getCount());
- putShort(item.getMeta());
-
- byte[] nbt = item.getCompoundTag() != null ? BinaryUtils.writeNBT(item.getCompoundTag()) : new byte[0];
- putShort((short) nbt.length);
- put(nbt);
- }
- */
-
- /**
- * Puts a Google Protocol Buffers VarInt into the buffer
- * Code is from: https://gist.github.com/thinkofdeath/e975ddee04e9c87faf22
- *
- * @param i The VarInt as an Integer.
- */
- public void putVarInt(int i){
- while(i > 0x7f){
- putByte((byte) (i & 0x7f | 0x80));
- i >>= 7;
- }
- putByte((byte) i);
- }
-
- /**
- * Get a single line string containing each byte of the buffer in hexadecimal
- *
- * @return A String containing each byte of the buffer in hexadecimal with no newlines.
- */
- public String singleLineHexDump(){
- StringBuilder sb = new StringBuilder();
- byte[] data = bb.array();
- for(byte b : data){
- sb.append(String.format("%02X", b)).append(" ");
- }
- return sb.toString();
- }
-
- /**
- * Get the ByteOrder of the underlying ByteBuffer
- *
- * @return The ByteOrder of the ByteBuffer
- */
- public ByteOrder getOrder(){
- return bb.order();
- }
-
- /**
- * Set the ByteOrder of the underlying ByteBuffer
- *
- * @param order The ByteOrder to be set to.
- */
- public void setOrder(ByteOrder order){
- bb.order(order);
- }
-
- /**
- * Get the position of the underyling ByteBuffer
- *
- * @return The position in the buffer
- */
- public int getPosition() {
- return bb.position();
- }
-
- /**
- * Set the position of the underlying ByteBuffer
- *
- * @param position The position in the buffer to be set to
- */
- public void setPosition(int position) {
- bb.position(position);
- }
-
- /**
- * Get the amount of bytes remaining in the buffer
- *
- * @return The amount of remaining bytes in the buffer
- */
- public int remaining(){
- return bb.remaining();
- }
-
- /**
- * Get the remaining bytes in the buffer.
- *
- * NOTE: This DOES increase the position in the buffer.
- *
- * @return The reamaining bytes in the buffer.
- */
- public byte[] remainingBytes(){
- return get(remaining());
- }
-
- /**
- * Get a byte array of the buffer
- *
- * @return A byte array containing all the bytes in the buffer
- */
- public byte[] toArray(){
- return bb.array();
- }
-
- /**
- * Skip bytes amount of bytes in the buffer (equivalent to setPosition(getPosition() + len))
- *
- * @param bytes The amount of bytes to skip in the buffer
- */
- public void skip(int bytes){
- setPosition(getPosition() + bytes);
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/network/pipeline/packet/RawPacket.java b/src/main/java/org/blockserver/core/modules/network/pipeline/packet/RawPacket.java
deleted file mode 100644
index f1cce67..0000000
--- a/src/main/java/org/blockserver/core/modules/network/pipeline/packet/RawPacket.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.network.pipeline.packet;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.event.CancellableImplementation;
-
-import java.net.InetSocketAddress;
-
-/**
- * Represents a packet recieved or ready to be sent in byte form.
- *
- * @author BlockServer Team
- */
-public class RawPacket implements CancellableImplementation {
- @Getter @Setter private BinaryBuffer buffer;
- @Getter @Setter private InetSocketAddress address;
-
- public RawPacket(BinaryBuffer buffer, InetSocketAddress address) {
- this.buffer = buffer;
- this.address = address;
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/player/Player.java b/src/main/java/org/blockserver/core/modules/player/Player.java
deleted file mode 100644
index b6d6a74..0000000
--- a/src/main/java/org/blockserver/core/modules/player/Player.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.player;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.Server;
-import org.blockserver.core.modules.message.Message;
-import org.blockserver.core.modules.world.positions.Location;
-
-import java.net.InetSocketAddress;
-import java.util.UUID;
-
-/**
- * Represents a Player on the server.
- *
- * @author BlockServer Team
- */
-public class Player {
- @Getter private final Server server;
- @Getter private final InetSocketAddress address;
- @Getter private final String name;
- @Getter private final UUID UUID;
- @Getter @Setter private int x;
- @Getter @Setter private int y;
- @Getter @Setter private int z;
-
- public Player(Server server, InetSocketAddress address, String name, UUID UUID) {
- this.server = server;
- this.address = address;
- this.name = name;
- this.UUID = UUID;
- }
-
- public Location getLocation() {
- return new Location(x, y, z);
- }
-
- public void sendMessage(Message message) {
-
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/player/PlayerModule.java b/src/main/java/org/blockserver/core/modules/player/PlayerModule.java
deleted file mode 100644
index 671656c..0000000
--- a/src/main/java/org/blockserver/core/modules/player/PlayerModule.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.player;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.logging.LoggingModule;
-import org.blockserver.core.modules.network.pipeline.PipelineProviderImplementation;
-
-import java.net.InetSocketAddress;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-
-/**
- * Module that handles players.
- *
- * @author BlockServer Team
- * @see org.blockserver.core.module.Module
- */
-public class PlayerModule extends ServerModule {
- private final Set players = Collections.synchronizedSet(new HashSet<>());
-
- public PlayerModule(Server server) {
- super(server);
- }
-
- @Override
- public void enable() {
- super.enable();
- }
-
- @Override
- public void disable() {
- players.clear();
- super.disable();
- }
-
- /**
- * Attempts to find a current online {@linkplain Player} with the specified name. If
- * there is no {@linkplain Player} found this method will return null.
- *
- * @param name ({@linkplain String}): The name of the {@linkplain Player} to locate.
- * @return player - ({@linkplain Player}): The {@linkplain Player} with the given name or null.
- */
- public Player getPlayer(String name) {
- for (Player player : players) {
- if (player.getName().equals(name))
- return player;
- }
- return null;
- }
-
- /**
- * Attempts to find a current online {@linkplain Player} with the specified {@linkplain UUID}. If
- * there is no {@linkplain Player} found this method will return null.
- *
- * @param name ({@linkplain UUID}): The {@linkplain UUID} of the {@linkplain Player} to locate.
- * @return player - ({@linkplain Player}): The {@linkplain Player} with the given {@linkplain UUID} or null.
- */
- public Player getPlayer(UUID name) {
- for (Player player : players) {
- if (player.getUUID().equals(name))
- return player;
- }
- return null;
- }
-
- /**
- * Attempts to find a current online {@linkplain Player} with the specified {@linkplain InetSocketAddress}. If
- * there is no {@linkplain Player} found this method will return null.
- *
- * @param address ({@linkplain InetSocketAddress}): The {@linkplain InetSocketAddress} of the {@linkplain Player} to locate.
- * @return player - ({@linkplain Player}): The {@linkplain Player} with the given {@linkplain InetSocketAddress} or null.
- */
- public Player getPlayer(InetSocketAddress address) {
- for (Player player : players) {
- if (player.getAddress().equals(address))
- return player;
- }
- return null;
- }
-
-
- /**
- * Opens a new session, and adds the specified {@linkplain Player} to the list of online {@linkplain Player}s.
- *
- * NOTE: THIS METHOD IS FOR INTERNAL USE ONLY!
- *
- * @param address ({@linkplain InetSocketAddress}): The new {@linkplain Player}'s {@linkplain InetSocketAddress}.
- * @param name ({@linkplain String}): The new {@linkplain Player}'s {@linkplain String}.
- * @param UUID ({@linkplain UUID}): The new {@linkplain Player}'s {@linkplain UUID}.
- * @param provider {{@linkplain PipelineProviderImplementation}}: The {@linkplain Player}'s {@linkplain PipelineProviderImplementation} that is used
- * to communicate with the client.
- */
- public void internalOpenSession(InetSocketAddress address, String name, UUID UUID, PipelineProviderImplementation provider) {
- players.add(new Player(getServer(), address, name, UUID/*, provider*/));
- getServer().getModule(LoggingModule.class).debug("New session from " + address.getHostString() + ":" + address.getPort());
- }
-
- /**
- * Removes a Player from the list of online players.
- *
- * NOTE: THIS METHOD IS FOR INTERNAL USE ONLY!
- *
- * @param player The player to be removed.
- */
- public void internalCloseSession(Player player) {
- players.remove(player);
- getServer().getModule(LoggingModule.class).debug("Session " + player.getAddress().getHostString() + ":" + player.getAddress().getPort() + " closed.");
- }
-
- public Set getPlayers() {
- return Collections.unmodifiableSet(players);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/scheduler/SchedulerModule.java b/src/main/java/org/blockserver/core/modules/scheduler/SchedulerModule.java
deleted file mode 100644
index e308006..0000000
--- a/src/main/java/org/blockserver/core/modules/scheduler/SchedulerModule.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.scheduler;
-
-import lombok.Getter;
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.thread.ExecutorModule;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see ServerModule
- */
-public class SchedulerModule extends ServerModule {
- @Getter private final Map tasks = new HashMap<>();
- private final ExecutorModule executorModule;
-
- public SchedulerModule(Server server, ExecutorModule executorModule) {
- super(server);
- this.executorModule = executorModule;
- }
-
- //TODO maybe make this better!
- @Override
- public void enable() {
- executorModule.getExecutorService().execute(() -> {
- while (isEnabled()) {
- for (Map.Entry entry : tasks.entrySet()) {
- TaskData taskData = entry.getValue();
- if (taskData.getNextTickTime() > System.currentTimeMillis())
- continue;
- taskData.repeatTimes--;
- //So by doing this every task will be run at the same time... not in series... is that ok?
- executorModule.getExecutorService().execute(() -> entry.getKey().run());
- //
- if (taskData.getRepeatTimes() <= 0)
- tasks.remove(entry.getKey());
- taskData.setLastTickTime(System.currentTimeMillis());
- }
- try {
- Thread.sleep(1L);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- });
- super.enable();
- }
-
- @Override
- public void disable() {
- tasks.clear();
- super.disable();
- }
-
- public void registerTask(Runnable task, double delay) {
- registerTask(task, delay, 1);
- }
-
- public void registerTask(Runnable task, int repeatTimes) {
- registerTask(task, 1, repeatTimes);
- }
-
- public void registerTask(Runnable task, double delay, int repeatTimes) {
- registerTask(task, new TaskData(delay, repeatTimes));
- }
-
- public void registerTask(Runnable task, TaskData taskData) {
- synchronized (tasks) {
- tasks.put(task, taskData);
- }
- }
-
- public TaskData getTaskData(Runnable task) {
- synchronized (tasks) {
- return tasks.get(task);
- }
- }
-
- public void setTaskData(Runnable task, TaskData taskData) {
- synchronized (tasks) {
- tasks.put(task, taskData);
- }
- }
-
- public void setTaskDelay(Runnable task, double delay) {
- getTaskData(task).setDelay(delay);
- }
-
- public void setTaskRepeatTimes(Runnable task, int repeatTimes) {
- getTaskData(task).setRepeatTimes(repeatTimes);
- }
-
- public double getTaskDelay(Runnable task) {
- return getTaskData(task).getDelay();
- }
-
- public int getTaskRepeatTimes(Runnable task) {
- return getTaskData(task).getRepeatTimes();
- }
-
- public void cancelTask(Runnable task) {
- synchronized (tasks) {
- tasks.remove(task);
- }
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/scheduler/TaskData.java b/src/main/java/org/blockserver/core/modules/scheduler/TaskData.java
deleted file mode 100644
index 55e20ff..0000000
--- a/src/main/java/org/blockserver/core/modules/scheduler/TaskData.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.scheduler;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see SchedulerModule
- */
-public class TaskData {
- @Getter @Setter protected long lastTickTime;
- @Getter @Setter protected double delay;
- @Getter @Setter protected int repeatTimes;
-
- public TaskData(double delay, int repeatTimes) {
- this.delay = delay;
- this.repeatTimes = repeatTimes;
- }
-
- public long getNextTickTime() {
- return lastTickTime + (long) delay;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/serverlist/ServerListModule.java b/src/main/java/org/blockserver/core/modules/serverlist/ServerListModule.java
deleted file mode 100644
index 7e5f8cc..0000000
--- a/src/main/java/org/blockserver/core/modules/serverlist/ServerListModule.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.serverlist;
-
-import lombok.Getter;
-import org.blockserver.core.Server;
-import org.blockserver.core.event.ServerEventListener;
-import org.blockserver.core.events.packets.PacketEvent;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.scheduler.SchedulerModule;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see ServerModule
- */
-public class ServerListModule extends ServerModule {
- private final SchedulerModule schedulerModule;
- @Getter private final Runnable task;
- private final ServerEventListener listener;
-
- public ServerListModule(Server server, SchedulerModule schedulerModule) {
- super(server);
- this.schedulerModule = schedulerModule;
- task = () -> {
- //networkModule.sendPackets();
- //send things
- };
- listener = new ServerEventListener() {
- @Override
- public void onEvent(PacketEvent event) {
- //receive pings
- //send pongs
- }
- };
- }
-
- @Override
- public void enable() {
- schedulerModule.registerTask(task, 1.0, Integer.MAX_VALUE);
- listener.register(PacketEvent.class, getServer());
- super.enable();
- }
-
- @Override
- public void disable() {
- schedulerModule.cancelTask(task);
- listener.unregister(getServer());
- super.disable();
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/thread/ExecutorModule.java b/src/main/java/org/blockserver/core/modules/thread/ExecutorModule.java
deleted file mode 100644
index e3b2a19..0000000
--- a/src/main/java/org/blockserver/core/modules/thread/ExecutorModule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.thread;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-import org.blockserver.core.modules.config.ConfigModule;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * Created by Exerosis.
- */
-public class ExecutorModule extends ServerModule {
- private final ConfigModule configModule;
- @Getter @Setter private ExecutorService executorService = Executors.newFixedThreadPool(4);
-
- public ExecutorModule(Server server, ConfigModule configModule) {
- super(server);
- this.configModule = configModule;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/Block.java b/src/main/java/org/blockserver/core/modules/world/Block.java
deleted file mode 100644
index 76e10db..0000000
--- a/src/main/java/org/blockserver/core/modules/world/Block.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-import lombok.Getter;
-import org.blockserver.core.modules.world.positions.Vector;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see WorldModule
- */
-public class Block {
- @Getter private ChunkPosition chunk;
- @Getter private Material material;
- @Getter private byte lightLevel;
- @Getter private Vector vector;
-
- /**
- * Sets lightlevel between 0 and 15.
- *
- * @param lightLevel block lightlevel
- */
- public void setLightLevel(byte lightLevel) {
- this.lightLevel = lightLevel;
- }
-
- /**
- * Sets block material.
- *
- * @param material block material
- * @see Material
- */
- public void setMaterial(Material material) {
- this.material = material;
- /*
- for (Player player : world.getPlayers()) {
- player.sendMessage(new MessageOutBlockChange(player, this)); //TODO: Material
- }
- */
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/ChunkPosition.java b/src/main/java/org/blockserver/core/modules/world/ChunkPosition.java
deleted file mode 100644
index ac1d9d4..0000000
--- a/src/main/java/org/blockserver/core/modules/world/ChunkPosition.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see WorldModule
- */
-public class ChunkPosition {
- public Block getBlockAt(int x, int y, int z) {
- return null;
- }
-
- public int getChunkID() {
- throw new UnsupportedOperationException();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/ChunkProvider.java b/src/main/java/org/blockserver/core/modules/world/ChunkProvider.java
deleted file mode 100644
index cf82d3c..0000000
--- a/src/main/java/org/blockserver/core/modules/world/ChunkProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see WorldModule
- */
-public interface ChunkProvider {
- ChunkPosition loadChunkAt(int x, int y);
-
- void unloadChunkAt(int x, int y);
-
- void unloadChunk(ChunkPosition chunk);
-
- ChunkPosition getOrLoadChunkAt(int x, int y);
-
- boolean isChunkLoaded(int x, int y);
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/Material.java b/src/main/java/org/blockserver/core/modules/world/Material.java
deleted file mode 100644
index 260ed2b..0000000
--- a/src/main/java/org/blockserver/core/modules/world/Material.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see WorldServerModule
- */
-public enum Material {
-}
diff --git a/src/main/java/org/blockserver/core/modules/world/World.java b/src/main/java/org/blockserver/core/modules/world/World.java
deleted file mode 100644
index 739ed36..0000000
--- a/src/main/java/org/blockserver/core/modules/world/World.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-import org.blockserver.core.utilities.ByteUtil;
-
-public class World {
- private ChunkPosition[][] loadedChunks;
- private WorldAllocation worldAllocation;
-
- public World(short allocationSize) {
- worldAllocation = new WorldAllocation(allocationSize);
- }
-
- public void saveChunk(int x, int y) {
-
- }
-
- public short[][][] getChunk(int x, int y) {
- return worldAllocation.getChunkAt(loadedChunks[x][y].getChunkID());
- }
-
- public short getBlock(int x, int y, int z) {
- short[][][] chunk = getChunk(x / 16, y / 16);
- return chunk[x % 16][y % 16][z];
- }
-
- public byte getBlockMaterial(int x, int y, int z) {
- return ByteUtil.fromShort(getBlock(x, y, z))[0];
- }
-
- public byte getBlockLightLevel(int x, int y, int z) {
- return ByteUtil.fromShort(getBlock(x, y, z))[1];
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/WorldAllocation.java b/src/main/java/org/blockserver/core/modules/world/WorldAllocation.java
deleted file mode 100644
index 834334c..0000000
--- a/src/main/java/org/blockserver/core/modules/world/WorldAllocation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see WorldAllocation
- */
-public class WorldAllocation {
- private short[][][][] memoryAllocation;
-
- public WorldAllocation(short allocationSize) {
- int chunkCount = allocationSize / 131072 - allocationSize % 131072;
- memoryAllocation = new short[chunkCount][16][16][256];
-
- for (int i = 0; i < memoryAllocation.length; i++) {
- memoryAllocation[i] = null;
- }
- }
-
- public void setChunkAt(int id, short[][][] chunkData) {
- memoryAllocation[id] = chunkData;
- }
-
- public short[][][] getChunkAt(int id) {
- return memoryAllocation[id];
- }
-}
diff --git a/src/main/java/org/blockserver/core/modules/world/WorldModule.java b/src/main/java/org/blockserver/core/modules/world/WorldModule.java
deleted file mode 100644
index f448a9a..0000000
--- a/src/main/java/org/blockserver/core/modules/world/WorldModule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world;
-
-import org.blockserver.core.Server;
-import org.blockserver.core.module.ServerModule;
-
-/**
- * Created by Exerosis.
- */
-public class WorldModule extends ServerModule {
-
- public WorldModule(Server server) {
- super(server);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/positions/Location.java b/src/main/java/org/blockserver/core/modules/world/positions/Location.java
deleted file mode 100644
index 42a8551..0000000
--- a/src/main/java/org/blockserver/core/modules/world/positions/Location.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world.positions;
-
-import lombok.Getter;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see org.blockserver.core.modules.world.positions.Vector
- * @see org.blockserver.core.modules.world.WorldModule
- */
-public class Location extends Vector {
- @Getter long yaw;
- @Getter long pitch;
-
- public Location(Vector vector) {
- super(vector);
- }
-
- public Location(Location location) {
- this(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
- }
-
- public Location(float x, float y, float z) {
- super(x, y, z);
- }
-
- public Location(float x, float y, float z, long yaw, long pitch) {
- this(x, y, z);
- this.yaw = yaw;
- this.pitch = pitch;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/modules/world/positions/Vector.java b/src/main/java/org/blockserver/core/modules/world/positions/Vector.java
deleted file mode 100644
index d668fad..0000000
--- a/src/main/java/org/blockserver/core/modules/world/positions/Vector.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.modules.world.positions;
-
-import lombok.Getter;
-
-/**
- * Written by Exerosis!
- *
- * @author BlockServer Team
- * @see org.blockserver.core.modules.world.WorldModule
- */
-public class Vector {
- @Getter float x;
- @Getter float y;
- @Getter float z;
-
- public Vector(Vector vector) {
- this(vector.getX(), vector.getY(), vector.getZ());
- }
-
- public Vector(float x, float y, float z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/run.java b/src/main/java/org/blockserver/core/run.java
deleted file mode 100644
index 6a320e4..0000000
--- a/src/main/java/org/blockserver/core/run.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core;
-
-import org.blockserver.core.event.EventListener;
-import org.blockserver.core.events.modules.ModuleEnableEvent;
-import org.blockserver.core.module.loaders.CoreModuleLoader;
-import org.blockserver.core.module.loaders.JarModuleLoader;
-import org.blockserver.core.modules.logging.LoggingModule;
-
-/**
- * Main class for the core.
- *
- * @author BlockServer team
- */
-public class run {
-
- public static void main(String[] args) {
- Server server = new Server(new CoreModuleLoader(), new JarModuleLoader());
-
- new EventListener() {
- @Override
- public void onEvent(ModuleEnableEvent event) {
- System.out.println(event.getModule().getClass().getName());
- }
- }.register(ModuleEnableEvent.class, server.getEventManager());
-
- Runtime.getRuntime().addShutdownHook(new Thread(server::disable));
- server.enable();
- server.getModule(LoggingModule.class).info("BlockServer is now running.");
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/utilities/ArchiveUtils.java b/src/main/java/org/blockserver/core/utilities/ArchiveUtils.java
deleted file mode 100644
index 26e0d19..0000000
--- a/src/main/java/org/blockserver/core/utilities/ArchiveUtils.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.utilities;
-
-import java.io.*;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-public class ArchiveUtils {
- //TODO Make this whole thing not suck
- private ArchiveUtils() {
- }
-
- public static void downloadFileInto(CharSequence stringURL, File directory) {
- try {
- URL url = new URL(stringURL.toString());
- unzipIntoDirectory(url.openStream(), directory);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static File downloadFile(CharSequence stringURL, File directory) {
- try {
- if (directory.isFile()) {
- return null;
- }
- directory.mkdirs();
- URL url = new URL(stringURL.toString());
- String urlPath = url.getPath();
- String fileName = urlPath.substring(urlPath.lastIndexOf('/') + 1);
-
- String[] fileComponents = fileName.split("\\.");
-
- String extension = "";
- if (fileComponents.length >= 2)
- extension = fileComponents[1];
-
- if (!extension.equals("zip"))
- Files.copy(url.openStream(), Paths.get(directory.getPath() + extension), StandardCopyOption.REPLACE_EXISTING);
- else
- unzipIntoDirectory(url.openStream(), directory);
- return directory;
- } catch (Exception ignored) {
- }
- return null;
- }
-
- public static void copyFile(File from, File into) {
- if (!from.exists())
- return;
- if (from.getPath().equals(into.getPath()))
- return;
- from.setReadable(true);
- if (into.exists())
- into.delete();
- try {
- ByteUtil.writeBuffer(into, new FileInputStream(from), true);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static void unzipIntoDirectory(File file, File directory) {
- try {
- unzipIntoDirectory(new FileInputStream(file), directory);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
-
- public static void unzipIntoDirectory(InputStream inputStream, File directory) {
- if (directory.isFile())
- return;
- directory.mkdirs();
-
- try {
- inputStream = new BufferedInputStream(inputStream);
- inputStream = new ZipInputStream(inputStream);
-
- for (ZipEntry entry = null; (entry = ((ZipInputStream) inputStream).getNextEntry()) != null; ) {
- StringBuilder pathBuilder = new StringBuilder(directory.getPath()).append('/').append(entry.getName());
- File file = new File(pathBuilder.toString());
-
- if (entry.isDirectory()) {
- file.mkdirs();
- continue;
- }
-
- ByteUtil.write(pathBuilder, inputStream, false);
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- ByteUtil.closeQuietly(inputStream);
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/utilities/ByteUtil.java b/src/main/java/org/blockserver/core/utilities/ByteUtil.java
deleted file mode 100644
index 7bed872..0000000
--- a/src/main/java/org/blockserver/core/utilities/ByteUtil.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.utilities;
-
-import java.io.*;
-
-public class ByteUtil {
-
- private ByteUtil() {
- }
-
- public static short toShort(byte... bytes) {
- return (short) ((bytes[0] << 8) + bytes[1]);
- }
-
- public static byte[] fromShort(short number) {
- return new byte[]{(byte) (number >> 8), (byte) (number & 255)};
- }
-
- public static void write(CharSequence path, InputStream stream, boolean close) {
- write(new File(path.toString()), stream, close);
- }
-
- public static void write(File file, InputStream stream, boolean close) {
- file.getParentFile().mkdirs();
- if (file.exists())
- file.delete();
-
- OutputStream fileOutputStream = null;
- try {
- fileOutputStream = new FileOutputStream(file);
- fileOutputStream = new BufferedOutputStream(fileOutputStream);
- // IOUtils.copy(stream, fileOutputStream);
-
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- ByteUtil.closeQuietly(fileOutputStream);
- if (close)
- ByteUtil.closeQuietly(stream);
- }
- }
-
- public static void writeBuffer(File file, InputStream inputStream, boolean close) {
- OutputStream outputStream = null;
- try {
- inputStream = new BufferedInputStream(inputStream);
-
- outputStream = new FileOutputStream(file);
- outputStream = new BufferedOutputStream(outputStream);
-
- //IOUtils.copy(inputStream, outputStream);
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- ByteUtil.closeQuietly(outputStream);
- if (close)
- ByteUtil.closeQuietly(inputStream);
- }
- }
-
- public static void closeQuietly(Closeable closeable) {
- if (closeable != null)
- try {
- if (closeable.getClass().isAssignableFrom(OutputStream.class))
- ((OutputStream) closeable).flush();
- closeable.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Gets bytes from InputStream
- *
- * @param stream The InputStream
- * @return Returns a byte[] representation of given stream
- */
-
- public static byte[] getBytesFromIS(InputStream stream) {
-
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- try {
- int nRead;
- byte[] data = new byte[16384];
-
- while ((nRead = stream.read(data, 0, data.length)) != -1) {
- buffer.write(data, 0, nRead);
- }
-
- buffer.flush();
- } catch (Exception e) {
- System.err.println("Failed to convert IS to byte[]!");
- e.printStackTrace();
- }
-
- return buffer.toByteArray();
-
- }
-
- /**
- * Gets bytes from class
- *
- * @param clazz The class
- * @return Returns a byte[] representation of given class
- */
-
- public static byte[] getBytesFromClass(Class> clazz) {
- return getBytesFromIS(clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".class"));
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/blockserver/core/utilities/FileUtil.java b/src/main/java/org/blockserver/core/utilities/FileUtil.java
deleted file mode 100644
index 260c09d..0000000
--- a/src/main/java/org/blockserver/core/utilities/FileUtil.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.utilities;
-
-import java.io.File;
-
-public class FileUtil {
- public static File getDirectoryUp(File file, int amount) {
- while (amount != 0) {
- file = file.getParentFile();
- amount--;
- }
- return file;
- }
-
- public static File searchFolder(File folder, String uniqueContent) {
- return searchFolder(folder, uniqueContent, 0);
- }
-
- private static File searchFolder(File folder, String uniqueContent, int depth) {
- if (folder != null)
- for (File file : folder.listFiles()) {
- if (file.getName().contains(uniqueContent))
- return file.getParentFile();
- if (file.isDirectory()) {
- File result = searchFolder(file, uniqueContent, depth++);
- if (result != null)
- return getDirectoryUp(result, depth - 1);
- }
- }
- return null;
- }
-
-
-}
diff --git a/src/main/java/org/blockserver/core/utilities/NetworkUtil.java b/src/main/java/org/blockserver/core/utilities/NetworkUtil.java
deleted file mode 100644
index 99b5e29..0000000
--- a/src/main/java/org/blockserver/core/utilities/NetworkUtil.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.utilities;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public final class NetworkUtil {
- private NetworkUtil() {
-
- }
-
- public static InetAddress getLocalHost() {
- try {
- return InetAddress.getLocalHost();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- }
- return null;
- }
-}
diff --git a/src/main/java/org/blockserver/core/utilities/Skin.java b/src/main/java/org/blockserver/core/utilities/Skin.java
deleted file mode 100644
index fb443b7..0000000
--- a/src/main/java/org/blockserver/core/utilities/Skin.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is part of BlockServer.
- *
- * BlockServer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * BlockServer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with BlockServer. If not, see .
- */
-package org.blockserver.core.utilities;
-
-/**
- * Utility class that represents a Skin.
- */
-public class Skin {
- public byte[] bytes;
- public String skinName;
-}
diff --git a/src/main/java/org/blocksever/test/core/CoreModuleLoader.java b/src/main/java/org/blocksever/test/core/CoreModuleLoader.java
new file mode 100644
index 0000000..d009b5d
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/CoreModuleLoader.java
@@ -0,0 +1,46 @@
+package org.blocksever.test.core;
+
+import org.blocksever.test.core.test.TestModule1;
+import org.blocksever.test.core.test.TestModule2;
+import org.blocksever.test.core.test.TestNetworkModule;
+
+/**
+ * Created by Exerosis.
+ */
+public class CoreModuleLoader extends Module {
+ private final TestModule1 testModule1;
+ private final TestModule2 testModule2;
+ private final TestNetworkModule testNetworkModule;
+
+ public CoreModuleLoader() {
+ testModule1 = new TestModule1();
+ testModule2 = new TestModule2();
+ testNetworkModule = new TestNetworkModule();
+ }
+
+ @Override
+ protected void onEnable() {
+ testModule1.enable();
+ testModule2.enable();
+ testNetworkModule.enable();
+ }
+
+ @Override
+ protected void onDisable() {
+ testModule1.disable();
+ testModule2.disable();
+ testNetworkModule.disable();
+ }
+
+ public TestNetworkModule getTestNetworkModule() {
+ return testNetworkModule;
+ }
+
+ public TestModule1 getTestModule1() {
+ return testModule1;
+ }
+
+ public TestModule2 getTestModule2() {
+ return testModule2;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/Enableable.java b/src/main/java/org/blocksever/test/core/Enableable.java
new file mode 100644
index 0000000..430777b
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/Enableable.java
@@ -0,0 +1,12 @@
+package org.blocksever.test.core;
+
+/**
+ * Created by Exerosis.
+ */
+public interface Enableable {
+ void enable();
+
+ boolean isEnabled();
+
+ void disable();
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/Module.java b/src/main/java/org/blocksever/test/core/Module.java
new file mode 100644
index 0000000..4149241
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/Module.java
@@ -0,0 +1,35 @@
+package org.blocksever.test.core;
+
+public class Module implements Enableable {
+ private boolean enabled = false;
+
+ @Override
+ public void enable() {
+ if (isEnabled())
+ return;
+ onEnable();
+ enabled = true;
+ }
+
+ @Override
+ public void disable() {
+ if (!isEnabled())
+ return;
+ onDisable();
+ enabled = false;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ protected void onEnable() {
+
+ }
+
+
+ protected void onDisable() {
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/Server.java b/src/main/java/org/blocksever/test/core/Server.java
new file mode 100644
index 0000000..ba3d963
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/Server.java
@@ -0,0 +1,31 @@
+package org.blocksever.test.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Server extends Module {
+
+ public static void main(String[] args) {
+ new Server().enable();
+ }
+
+ private final Map moduleLoaders = new HashMap<>();
+
+ public Server() {
+ moduleLoaders.put("CoreModuleLoader", new CoreModuleLoader());
+ }
+
+ @Override
+ protected void onEnable() {
+ System.out.println("Starting the Server!");
+ moduleLoaders.values().forEach(Module::enable);
+ System.out.println("Enabled the Server!");
+ }
+
+ @Override
+ protected void onDisable() {
+ System.out.println("Stopping the Server!");
+ moduleLoaders.values().forEach(Module::disable);
+ System.out.println("Disabled the Server!");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/networking/NetworkDispatcher.java b/src/main/java/org/blocksever/test/core/networking/NetworkDispatcher.java
new file mode 100644
index 0000000..ebc340c
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/networking/NetworkDispatcher.java
@@ -0,0 +1,8 @@
+package org.blocksever.test.core.networking;
+
+/**
+ * Created by Exerosis.
+ */
+public interface NetworkDispatcher {
+ void dispatch(RawPacket packet);
+}
diff --git a/src/main/java/org/blocksever/test/core/networking/NetworkManager.java b/src/main/java/org/blocksever/test/core/networking/NetworkManager.java
new file mode 100644
index 0000000..2c07b48
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/networking/NetworkManager.java
@@ -0,0 +1,29 @@
+package org.blocksever.test.core.networking;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Created by Exerosis.
+ */
+public class NetworkManager {
+ private final Set dispatchers = new HashSet<>();
+
+ public NetworkManager() {
+ }
+
+ public void registerDispatcher(NetworkDispatcher dispatcher){
+ dispatchers.add(dispatcher);
+ }
+
+ public void dispatch(RawPacket packet){
+ for (NetworkDispatcher dispatcher : dispatchers) {
+ dispatcher.dispatch(packet);
+ }
+ }
+
+ public Set getDispatchers() {
+ return Collections.unmodifiableSet(dispatchers);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/networking/RawPacket.java b/src/main/java/org/blocksever/test/core/networking/RawPacket.java
new file mode 100644
index 0000000..3a1eb1d
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/networking/RawPacket.java
@@ -0,0 +1,17 @@
+package org.blocksever.test.core.networking;
+
+/**
+ * Created by Exerosis.
+ */
+public class RawPacket {
+ private String testMessage;
+
+ public RawPacket(String testMessage) {
+ this.testMessage = testMessage;
+ }
+
+ @Override
+ public String toString() {
+ return testMessage;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/test/TestModule1.java b/src/main/java/org/blocksever/test/core/test/TestModule1.java
new file mode 100644
index 0000000..add198c
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/test/TestModule1.java
@@ -0,0 +1,18 @@
+package org.blocksever.test.core.test;
+
+import org.blocksever.test.core.Module;
+
+/**
+ * Created by Exerosis.
+ */
+public class TestModule1 extends Module {
+ @Override
+ protected void onEnable() {
+ System.out.println("Enabled test module number 1");
+ }
+
+ @Override
+ protected void onDisable() {
+ System.out.println("Disabled test module number 1");
+ }
+}
diff --git a/src/main/java/org/blocksever/test/core/test/TestModule2.java b/src/main/java/org/blocksever/test/core/test/TestModule2.java
new file mode 100644
index 0000000..a8c3c30
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/test/TestModule2.java
@@ -0,0 +1,18 @@
+package org.blocksever.test.core.test;
+
+import org.blocksever.test.core.Module;
+
+/**
+ * Created by Exerosis.
+ */
+public class TestModule2 extends Module {
+ @Override
+ protected void onEnable() {
+ System.out.println("Enabled test module number 2");
+ }
+
+ @Override
+ protected void onDisable() {
+ System.out.println("Disabled test module number 2");
+ }
+}
diff --git a/src/main/java/org/blocksever/test/core/test/TestNetworkModule.java b/src/main/java/org/blocksever/test/core/test/TestNetworkModule.java
new file mode 100644
index 0000000..5e4d5cf
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/test/TestNetworkModule.java
@@ -0,0 +1,42 @@
+package org.blocksever.test.core.test;
+
+import org.blocksever.test.core.Module;
+import org.blocksever.test.core.networking.NetworkManager;
+import org.blocksever.test.core.networking.RawPacket;
+import org.blocksever.test.core.test.networking.EventDispatcher;
+import org.blocksever.test.core.test.networking.PENetworkHandler;
+
+/**
+ * Created by Exerosis.
+ */
+public class TestNetworkModule extends Module {
+ private final NetworkManager inboundManager = new NetworkManager();
+ private final NetworkManager outboundManager = new NetworkManager();
+
+ public TestNetworkModule() {
+ EventDispatcher eventDispatcher = new EventDispatcher();
+ PENetworkHandler peNetworkHandler = new PENetworkHandler(inboundManager);
+ inboundManager.registerDispatcher(eventDispatcher);
+ outboundManager.registerDispatcher(eventDispatcher);
+
+ outboundManager.registerDispatcher(peNetworkHandler);
+
+ peNetworkHandler.testDisptach(new RawPacket("MovePacket"));
+ peNetworkHandler.testDisptach(new RawPacket("InteractPacket"));
+ peNetworkHandler.testDisptach(new RawPacket("ChatPacket"));
+
+ outboundManager.dispatch(new RawPacket("WeatherPacket"));
+ outboundManager.dispatch(new RawPacket("ChunkPacket"));
+ outboundManager.dispatch(new RawPacket("TimePacket"));
+ }
+
+ @Override
+ protected void onEnable() {
+ System.out.println("Enabled network test module");
+ }
+
+ @Override
+ protected void onDisable() {
+ System.out.println("Disabled network test module");
+ }
+}
diff --git a/src/main/java/org/blocksever/test/core/test/networking/EventDispatcher.java b/src/main/java/org/blocksever/test/core/test/networking/EventDispatcher.java
new file mode 100644
index 0000000..1a62b17
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/test/networking/EventDispatcher.java
@@ -0,0 +1,19 @@
+package org.blocksever.test.core.test.networking;
+
+import org.blocksever.test.core.networking.NetworkDispatcher;
+import org.blocksever.test.core.networking.RawPacket;
+
+/**
+ * Created by Exerosis.
+ */
+public class EventDispatcher implements NetworkDispatcher {
+
+ public EventDispatcher() {
+ System.out.println("Created Event Dispatcher");
+ }
+
+ @Override
+ public void dispatch(RawPacket packet) {
+ System.out.println("Firing RawPacketEvent for packet: " + packet.toString());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/blocksever/test/core/test/networking/PENetworkHandler.java b/src/main/java/org/blocksever/test/core/test/networking/PENetworkHandler.java
new file mode 100644
index 0000000..4a4e958
--- /dev/null
+++ b/src/main/java/org/blocksever/test/core/test/networking/PENetworkHandler.java
@@ -0,0 +1,26 @@
+package org.blocksever.test.core.test.networking;
+
+import org.blocksever.test.core.networking.NetworkDispatcher;
+import org.blocksever.test.core.networking.NetworkManager;
+import org.blocksever.test.core.networking.RawPacket;
+
+/**
+ * Created by Exerosis.
+ */
+public class PENetworkHandler implements NetworkDispatcher {
+ private NetworkManager manager;
+
+ public PENetworkHandler(NetworkManager manager) {
+ this.manager = manager;
+ }
+
+ public void testDisptach(RawPacket packet){
+ System.out.println("Recived " + packet.toString() + " from PE client!");
+ manager.dispatch(packet);
+ }
+
+ @Override
+ public void dispatch(RawPacket packet) {
+ System.out.println("Dispatching packet, to PE client! " + packet.toString());
+ }
+}
\ No newline at end of file