forked from SpigotMC/BungeeCord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b876fb2
Showing
23 changed files
with
1,495 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Eclipse stuff | ||
/.classpath | ||
/.project | ||
/.settings | ||
|
||
# netbeans | ||
/nbproject | ||
/nbactions.xml | ||
/nb-configuration.xml | ||
|
||
# we use maven! | ||
/build.xml | ||
|
||
# maven | ||
/target | ||
/dependency-reduced-pom.xml | ||
|
||
# vim | ||
.*.sw[a-p] | ||
|
||
# various other potential build files | ||
/build | ||
/bin | ||
/dist | ||
/manifest.mf | ||
|
||
# Mac filesystem dust | ||
/.DS_Store | ||
|
||
# intellij | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# other files | ||
*log* | ||
*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2012, md_5. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
The name of the author may not be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BungeeCord | ||
====== | ||
|
||
The most reliable Minecraft server portal suite. | ||
|
||
Coding guidelines | ||
----------- | ||
|
||
Its not fun to always have to stick to a set of rules, but here are are few to make sure everyone gets the best experience. | ||
* Have verbose commit messages, this makes it much easier to revert commits if the need arises. | ||
* Rebase your commits onto the tracked branch. No merges please. | ||
* Use for spaces, NO tabs. | ||
* Use lombok wherever possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>net.md-5</groupId> | ||
<artifactId>bungeecord</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>BungeeCord</name> | ||
<url>https://github.com/Shadowraze/BungeeCord</url> | ||
<inceptionYear>2012</inceptionYear> | ||
<licenses> | ||
<license> | ||
<name>The BSD 3-Clause License</name> | ||
<url>http://opensource.org/licenses/BSD-3-Clause</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<scm> | ||
<connection>scm:git:git@github.com:Shadowraze/BungeeCord.git</connection> | ||
<developerConnection>scm:git:git@github.com:Shadowraze/BungeeCord.git</developerConnection> | ||
<url>git@github.com:Shadowraze/BungeeCord.git</url> | ||
</scm> | ||
<issueManagement> | ||
<system>GitHub</system> | ||
<url>https://github.com/Shadowraze/BungeeCord/issues</url> | ||
</issueManagement> | ||
<ciManagement> | ||
<system>jenkins</system> | ||
<url>http://ci.md-5.net/job/BungeeCord</url> | ||
</ciManagement> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<build.number>unknown</build.number> | ||
<main.class>net.md_5.bungee.BungeeCord</main.class> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>13.0.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcprov-jdk15on</artifactId> | ||
<version>1.47</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bukkit</groupId> | ||
<artifactId>minecraft-server</artifactId> | ||
<version>1.3.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.yaml</groupId> | ||
<artifactId>snakeyaml</artifactId> | ||
<version>1.11</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>0.11.4</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>repobo-snap</id> | ||
<url>http://repo.bukkit.org/content/groups/public</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>bukkit-plugins</id> | ||
<url>http://repo.bukkit.org/content/groups/public</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
<build> | ||
<finalName>${project.name}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.lukegb.mojo</groupId> | ||
<artifactId>gitdescribe-maven-plugin</artifactId> | ||
<version>1.3</version> | ||
<configuration> | ||
<outputPrefix>git-${project.name}-${project.version}-</outputPrefix> | ||
<outputPostfix>-${build.number}</outputPostfix> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>gitdescribe</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.5.1</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Main-Class>${main.class}</Main-Class> | ||
<Implementation-Version>${describe}</Implementation-Version> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>2.0</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<filters> | ||
<filter> | ||
<artifact>*:*</artifact> | ||
<excludes> | ||
<exclude>META-INF/*.SF</exclude> | ||
<exclude>META-INF/*.DSA</exclude> | ||
</excludes> | ||
</filter> | ||
<filter> | ||
<artifact>org.bukkit:minecraft-server</artifact> | ||
<excludes> | ||
<exclude>org/bouncycastle/**</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> | ||
<minimizeJar>true</minimizeJar> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package net.md_5.bungee; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.net.InetSocketAddress; | ||
import java.net.Socket; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import static net.md_5.bungee.Logger.$; | ||
|
||
public class BungeeCord { | ||
|
||
/** | ||
* Current software instance. | ||
*/ | ||
public static BungeeCord instance; | ||
/** | ||
* Current operation state. | ||
*/ | ||
public volatile boolean isRunning; | ||
/** | ||
* Configuration. | ||
*/ | ||
public final Configuration config = new Configuration(); | ||
/** | ||
* Thread pool. | ||
*/ | ||
public final ExecutorService threadPool = Executors.newCachedThreadPool(); | ||
/** | ||
* locations.yml save thread. | ||
*/ | ||
private final ReconnectSaveThread saveThread = new ReconnectSaveThread(); | ||
/** | ||
* Server socket listener. | ||
*/ | ||
private ListenThread listener; | ||
/** | ||
* Current version. | ||
*/ | ||
private String version = (getClass().getPackage().getImplementationVersion() == null) ? "unknown" : getClass().getPackage().getImplementationVersion(); | ||
|
||
public static void main(String[] args) throws IOException { | ||
System.out.println(Util.hex(15)); | ||
instance = new BungeeCord(); | ||
$().info("Enabled BungeeCord version " + instance.version); | ||
instance.start(); | ||
|
||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
while (instance.isRunning) { | ||
String line = br.readLine(); | ||
if (line != null) { | ||
if (line.equals("end")) { | ||
instance.stop(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public void start() throws IOException { | ||
config.load(); | ||
isRunning = true; | ||
|
||
InetSocketAddress addr = Util.getAddr(config.bindHost); | ||
listener = new ListenThread(addr); | ||
listener.start(); | ||
|
||
saveThread.start(); | ||
$().info("Listening on " + addr); | ||
} | ||
|
||
public void stop() { | ||
this.isRunning = false; | ||
|
||
$().info("Closing listen thread"); | ||
try { | ||
listener.socket.close(); | ||
listener.join(); | ||
} catch (InterruptedException | IOException ex) { | ||
$().severe("Could not close listen thread"); | ||
} | ||
|
||
$().info("Closing pending connections"); | ||
threadPool.shutdown(); | ||
|
||
$().info("Disconnecting " + "x" + " connections"); | ||
// TODO: Kick everyone | ||
|
||
$().info("Saving reconnect locations"); | ||
saveThread.interrupt(); | ||
try { | ||
saveThread.join(); | ||
} catch (InterruptedException ex) { | ||
} | ||
|
||
$().info("Thank you and goodbye"); | ||
} | ||
|
||
public int getOnlinePlayers() { | ||
return 123; | ||
} | ||
|
||
public void setSocketOptions(Socket socket) throws IOException { | ||
socket.setSoTimeout(config.timeout); | ||
socket.setTrafficClass(0x18); | ||
socket.setTcpNoDelay(true); | ||
} | ||
} |
Oops, something went wrong.