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

Remove NetBeans project files in favor of gradle files + updated docker #488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/logs/**
.idea/
/.gradle

# build files

Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Docker support, thanks to xinyifly

FROM openjdk:7-alpine
FROM openjdk:8-alpine
RUN apk -U add tini
WORKDIR /mnt
COPY ./ ./
RUN sh ./posix-compile.sh
ADD wz ./wz
ADD docker-launch.sh configuration.ini world.ini ./
ADD build/libs/HeavenMS.jar HeavenMS.jar
Copy link

@xinyifly xinyifly Jul 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the build from a clean clone: build/libs/HeavenMS.jar: no such file or directory

(Maybe you forgot to include ./gradlew build in a multi-stage build?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./gradlew build shouldn't be included in the image, as it will increase the image size and never cause containers to cache due to non-deterministic gradle builds and cache files. The project should be built out of docker for this reason.

EXPOSE 8484 7575 7576 7577
CMD exec tini -- sh ./docker-launch.sh
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Besides myself for maintaining this repository, credits are to be given to Wizet

Regarding distributability and usage of the code presented here: like it was before, this MapleStory server is open-source. By that, it is meant that anyone is **free to install, use, modify and redistribute the contents**, as long as there is **no kind of commercial trading involved** and the **credits to the original creators are maintained** within the codes.

This is a NetBeans 8.2 Project, that should be built and run on Java 8 in order to run properly (used to be ran in Java 7, thanks @kolakcc for the Java 8 support!).

Being a NetBeans 8.2 Project, this means that it's easier to install the project via opening the server project folder inside NetBeans' IDE. Once installed, build this project on your machine and run the server using the "launch.bat" application.

In this project, many gameplay-wise issues generated from either the original WZ files and the server source have been partially or completely solved. Considering the use of the provided edited WZ's and server-side wz.xml files should be of the greatest importance when dealing with this instance of server source, in order to perceive it at it's full potential. My opinion, though!

The main objective of this project is to try as best as possible to recreate what once was the original MapleStory v83, while adding up some flavors that spices up the gameplay. In other words, aim to get the best of the MapleStory of that era.
Expand Down Expand Up @@ -176,18 +172,19 @@ Now it is OPTIONAL, you don't need to run it if you don't want, as it will simpl
At the end of the execution of these SQLs, you should have installed a database schema named "heavenms". REGISTER YOUR FIRST ACCOUNT to be used in-game by **creating manually** an entry on the table "accounts" at that database with a login and a password.

Configure the IP you want to use for your MapleStory server in "configuration.ini" file, or set it as "localhost" if you want to run it only on your machine. Alternatively, you can use the IP given by Hamachi to use on a Hamachi network, or you can use a non-Hamachi method of port-forwarding. Neither will be approached here.

#### Open the NetBeans project

Now open NetBeans, and click "Open a project..." . Select then the "HeavenMS" folder, that should already be a project recognizable by NetBeans. If it isn't, you have a problem.

Inside the project, you may encounter some code errors.

If that's the case, you have yet to set the core JARs of the project. From the project hierarchy, right-click the project and select "Resolve Project Problems".

Locate the folder "cores" inside the root directory of this project and manually configure the missing files on NetBeans (mina-core, slf4j-api, ...).

Finally, select "Clean and Build project" to build the JAR file for the MapleStory server. Once done, make sure both WampServer and Hamachi are on and functional, then execute "launch.bat" on the root of the project. If no errors were raised from this action, your MapleStory server is now online.

#### Launching the server
* If using **Windows**:
* Double click `launch.bat` in this
* If using **Non-Windows**:
* Open this directory in a terminal.
* Run `./gradlew run`.
* If using **Docker**:
* Build the project with `./gradlew build`.
* `docker-compose up` will get you a new database instance and start the server.
* Keep in mind that any changes to the sources requires a rebuild with `./gradlew build`.

Once done, make sure both WampServer and Hamachi are on and functional, then execute "launch.bat" on the root of the project. If no errors were raised from this action, your MapleStory server is now online.

---
### Installing the CLIENT
Expand Down Expand Up @@ -243,6 +240,27 @@ To change a character's GM level, make sure that character is not logged in, the
* Hit APPLY CHANGES.

---
### Server Development
To edit server files, you need a text editor. We recommend using one of these two IDEs:

#### Using NetBeans
Open NetBeans, and click "Open a project..." . Select then the "HeavenMS" folder, that should already be a project recognizable by NetBeans. If it isn't, you have a problem.

Inside the project, you may encounter some code errors.

If that's the case, you have yet to set the core JARs of the project. From the project hierarchy, right-click the project and select "Resolve Project Problems".

Locate the folder "cores" inside the root directory of this project and manually configure the missing files on NetBeans (mina-core, slf4j-api, ...).

Finally, select "Clean and Build project" to build the JAR file for the MapleStory server. Once done, make sure both WampServer and Hamachi are on and functional, then execute "launch.bat" on the root of the project. If no errors were raised from this action, your MapleStory server is now online.

#### Using IntelliJ IDEA

* Make sure you have downloaded this respository using Clone or Download.
* Use `File > Open` to select the `build.gradle` file within this project.
* IntelliJ should configure the rest automatically.


### Some notes about WZ/WZ.XML EDITING

NOTE: Be extremely wary when using server-side's XMLs data being reimported into the client's WZ, as some means of synchronization between the server and client modules, this action COULD generate some kind of bugs afterwards. Client-to-server data reimporting seems to be fine, though.
Expand Down
40 changes: 40 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
plugins {
id 'java'
id 'application'
}

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
mavenCentral()
}

dependencies {
implementation group: 'com.zaxxer', name: 'HikariCP-java7', version: '2.4.13'
implementation group: 'org.apache.mina', name: 'mina-core', version: '2.0.19'
implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
implementation group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.5'
}

sourceSets {
main {
java {
srcDirs 'src'
}
}
}

mainClassName = "net.server.Server"

jar {
manifest {
attributes(
'Main-Class': mainClassName
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
73 changes: 0 additions & 73 deletions build.xml

This file was deleted.

Binary file removed cores/HikariCP-java7-2.4.13.jar
Binary file not shown.
Binary file removed cores/mina-core-2.0.19.jar
Binary file not shown.
Binary file removed cores/mysql-connector-java-bin.jar
Binary file not shown.
Binary file removed cores/slf4j-api-1.7.21.jar
Binary file not shown.
Binary file removed cores/slf4j-jdk14-1.7.5.jar
Binary file not shown.
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3.3'
services:
db:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'heavenms'
MYSQL_ROOT_PASSWORD: ''
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- my-db:/var/lib/mysql
- ./sql:/docker-entrypoint-initdb.d

heavenms:
build: .
environment:
HOST: '127.0.0.1'
URL: 'jdbc:mysql://db:3306/heavenms'
DB_USER: 'root'
DB_PASS: ''
JAVA8: 'true'
SHUTDOWNHOOK: 'true'
volumes:
- ./scripts:/mnt/scripts
ports:
- '8484:8484'
- '7575:7575'
- '7576:7576'
- '7577:7577'
expose:
- '8484'
- '7575'
- '7576'
- '7577'

volumes:
my-db:
3 changes: 2 additions & 1 deletion docker-launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ sed -i "s/HOST=.*/HOST=${HOST}/" configuration.ini
sed -i "s|URL=.*|URL=${URL}|" configuration.ini
sed -i "s/DB_USER=.*/DB_USER=${DB_USER}/" configuration.ini
sed -i "s/DB_PASS=.*/DB_PASS=${DB_PASS}/" configuration.ini
sed -i "s/JAVA8=.*/JAVA8=TRUE/" configuration.ini

exec sh ./posix-launch.sh
exec java -Xmx2048m -Dwzpath=wz -jar HeavenMS.jar
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading