Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sleiss authored Sep 25, 2017
2 parents 8d49424 + e5f4d90 commit 95c004f
Show file tree
Hide file tree
Showing 48 changed files with 1,380 additions and 616 deletions.
36 changes: 34 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
sudo: false
language: java
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
branches:
except:
- /^v[0-9]*/
notifications:
email: false
irc:
channels:
- "irc.spi.gt#hexagonmc"
use_notice: true
skip_join: true
install:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dbuild.number=$TRAVIS_BUILD_NUMBER -B -V
after_success:
# CREATE GIT TAG
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI"
- export GIT_TAG=v$TRAVIS_BUILD_NUMBER
- echo -n $GIT_TAG > VERSION
- git commit -m "Set build VERSION number" VERSION
- git tag $GIT_TAG -a -m "Generated tag from TravisCI build $TRAVIS_BUILD_NUMBER"
- git push --quiet https://[email protected]/dev-confidence/example-backend-api $GIT_TAG > /dev/null 2>&1
deploy:
provider: releases
skip_cleanup: true
api_key:
secure: ljpg29wmo0yPs+qXBVj1vHnY4WPXB1hNMDnHMxhXbPRhK5l9kCqJWy4YjJ6BbEb4keU5dMmt+cyB+Njr3IomJMoupVu0Osut/SNz4g0UZFTYYJQjvrurdmGxoh9E7xmc6Pcly+Pw99RSpqK+yD8SDDepTleHDv/8pC0d4Z5NZIJ9JJUeY2in1RXpStj7rJtmSN5XWFpWBGpHElFQqaSDfh62zn3bvb7J9oVA+NtBDXgpY1Km1Q76Evt4PuijOgdWx4rcNpi7UOd6XurkYuo4/igBEUE8HQSEIqgC0jxJg0gxtLbymPvW4sPXmEPhZwIUvoYFjX0DvlIqU8hbr/2CPtcHiKqnqTU92wgFFnf3Xvn2mdoCrgHDOcSA2JWsR70077bPzv+llNHN17mDlGE7vIiv54jNBkJpem8OBgDNIU2lDnhwZQr3ifZJ0ydhdhkYK7Kp1lAZtEZwbqs6cetlwLiuBH6wd3dErBduPQNLnl22qdhQQJFBXPkj+vHBAt9uSB3irWWME0XsR6G9OpzDYoO64vkkHnz1k7VK37ud2pe7yKYuUr+MUbyBnzycbKOhYRufPkMv8RJIbRH6lChRrZOamqbZTa1FFYsemgcJ9NG990tE0zJHw0G3vU+emxPY35UPIMZrSbzQ8mCOlwKfhAtubZRNe+V0ohJFvVx/dhI=
file:
- bootstrap/target/BungeeCord.jar
- module/*/target/*.jar
file_glob: true
on:
branch: master
cache:
directories:
- $HOME/.m2

13 changes: 13 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### What Hexacord version are you using? Post the output of /bungee


### Are you using Bungee plugins? If yes, please list all of them + versionnumber


### How can we reproduce the error/bug?


### Is an error message (bungee/spigot/client)? If yes, use pastebin.com and share the link.


### In addidtion to that, please explain your issue as detailed as possible.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
BungeeCord

BungeeCord for 1.7/1.8/1.9/1.10/1.11/1.12
==========
Layer 7 proxy designed to link Minecraft servers.
--------------------------------------------------
[![Build Status](https://travis-ci.org/HexagonMC/BungeeCord.svg?branch=master)](https://travis-ci.org/HexagonMC/BungeeCord)

This is a fork of md_5's BungeeCord
https://www.spigotmc.org/threads/1-8-1-9-bungeecord.392/

BungeeCord is a sophisticated proxy and API designed mainly to teleport players between multiple Minecraft servers. It is the latest incarnation of similar software written by the author from 2011-present.
This version reimplements Minecraft 1.7.10 and basic 1.7.10 Forge support.

Information
-----------
BungeeCord is maintained by [SpigotMC](https://www.spigotmc.org/) and has its own [discussion thread](https://www.spigotmc.org/go/bungeecord) with plenty of helpful information and links.
Since release 134+, SpongePls is no longer needed when using Sponge-servers within your network!

Source
------
Source code is currently available on [GitHub](https://www.spigotmc.org/go/bungeecord-git).
IMPORTANT: We WON'T fix any 1.7 bugs.
This fork is designed for keeping your old servers in your network, until your modspacks are available for 1.10.2/1.11.2 or higher.
Most of them are, so get rid of 1.7 fast and move to 1.10.2/1.11.2 modpacks asap.

Binaries
--------
Precompiled binaries are available for end users on [Jenkins](https://www.spigotmc.org/go/bungeecord-dl).
This version is maintained by https://hexagonmc.eu

(c) 2012-2017 SpigotMC Pty. Ltd.
###Releases can be downloaded here: [Releases](https://github.com/HexagonMC/BungeeCord/releases)
```
Modules are automatically downloaded from the releases page.
```
10 changes: 10 additions & 0 deletions api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,14 @@ public interface ProxyConfig
* The favicon used for the server ping list.
*/
Favicon getFaviconObject();

/**
* The server name for the server ping list.
*/
String getCustomServerName();

/**
* Whether the server should handle packets before the player has connected to a server
*/
boolean getAlwaysHandlePackets();
}
2 changes: 1 addition & 1 deletion bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<manifestEntries>
<Main-Class>net.md_5.bungee.Bootstrap</Main-Class>
<Implementation-Version>${describe}</Implementation-Version>
<Specification-Version>${maven.build.timestamp}</Specification-Version>
<Specification-Version>${build.number}</Specification-Version>
</manifestEntries>
</archive>
</configuration>
Expand Down
96 changes: 76 additions & 20 deletions bootstrap/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
Original file line number Diff line number Diff line change
@@ -1,51 +1,107 @@
package net.md_5.bungee;


import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.security.Security;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;

import com.google.gson.JsonIOException;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;

import joptsimple.OptionParser;
import joptsimple.OptionSet;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.command.ConsoleCommandSender;


public class BungeeCordLauncher
{

public static void main(String[] args) throws Exception
{
Security.setProperty( "networkaddress.cache.ttl", "30" );
Security.setProperty( "networkaddress.cache.negative.ttl", "10" );

OptionParser parser = new OptionParser();
parser.allowsUnrecognizedOptions();
parser.acceptsAll( Arrays.asList( "v", "version" ) );
parser.acceptsAll( Arrays.asList( "v", "version") );
parser.acceptsAll( Arrays.asList( "noconsole" ) );

OptionSet options = parser.parse( args );

if ( options.has( "version" ) )
if ( options.has("version") )
{
System.out.println( Bootstrap.class.getPackage().getImplementationVersion() );
System.out.println(Bootstrap.class.getPackage().getImplementationVersion());
return;
}

if ( BungeeCord.class.getPackage().getSpecificationVersion() != null && System.getProperty( "IReallyKnowWhatIAmDoingISwear" ) == null )
if ( BungeeCord.class.getPackage().getSpecificationVersion() != null && System.getProperty( "IReallyKnowWhatIAmDoingISwear" ) == null)
{
Date buildDate = new SimpleDateFormat( "yyyyMMdd" ).parse( BungeeCord.class.getPackage().getSpecificationVersion() );

Calendar deadline = Calendar.getInstance();
deadline.add( Calendar.WEEK_OF_YEAR, -4 );
if ( buildDate.before( deadline.getTime() ) )
String version = BungeeCord.class.getPackage().getSpecificationVersion();

if ( version.equalsIgnoreCase("unknown") )
{
System.err.println( "*** You are using a self compiled version ***" );
System.err.println( "*** Please make sure your server is up to date ***" );
System.err.println( "*** Using current version without warranty ***" );
System.err.println( "*** Server will start in 2 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 2 ) );
} else
{
System.err.println( "*** Warning, this build is outdated ***" );
System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" );
System.err.println( "*** You will get NO support regarding this build ***" );
System.err.println( "*** Server will start in 10 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
int currentVersion = Integer.parseInt( version );

try
{
URL api = new URL( "https://api.github.com/repos/HexagonMC/BungeeCord/releases/latest" );
URLConnection con = api.openConnection();
// 15 second timeout at various stages
con.setConnectTimeout( 15000 );
con.setReadTimeout( 15000 );

String tagName = null;

try
{
JsonObject json = new JsonParser().parse( new InputStreamReader( con.getInputStream() ) ).getAsJsonObject();
tagName = json.get( "tag_name" ).getAsString();

int latestVersion = Integer.parseInt( tagName.substring( 1, tagName.length() ) );

if ( latestVersion > currentVersion )
{
System.err.println("*** Warning, this build is outdated ***");
System.err.println("*** Please download a new build from https://github.com/HexagonMC/BungeeCord/releases ***");
System.err.println("*** You will get NO support regarding this build ***");
System.err.println("*** Server will start in 10 seconds ***");
Thread.sleep(TimeUnit.SECONDS.toMillis(10));
}
}
catch ( JsonIOException e )
{
throw new IOException(e);
}
catch ( JsonSyntaxException e )
{
throw new IOException( e );
}
catch( NumberFormatException e )
{
throw new IOException( e );
}
}
catch ( IOException e )
{
System.err.println( "*** Can not test if up to date ***" );
System.err.println( "*** Using current version without warranty ***" );
System.err.println( "*** Server will start in 2 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 2 ) );
}
}
}

Expand All @@ -59,7 +115,7 @@ public static void main(String[] args) throws Exception
String line;
while ( bungee.isRunning && ( line = bungee.getConsoleReader().readLine( ">" ) ) != null )
{
if ( !bungee.getPluginManager().dispatchCommand( ConsoleCommandSender.getInstance(), line ) )
if ( !bungee.getPluginManager().dispatchCommand(ConsoleCommandSender.getInstance(), line ) )
{
bungee.getConsole().sendMessage( ChatColor.RED + "Command not found" );
}
Expand Down
20 changes: 13 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<name>BungeeCord-Parent</name>
<description>Parent project for all BungeeCord modules.</description>
<url>https://github.com/SpigotMC/BungeeCord</url>
<url>https://github.com/HexagonMC/BungeeCord</url>
<inceptionYear>2012</inceptionYear>
<organization>
<name>SpigotMC</name>
Expand All @@ -34,6 +34,12 @@
<developer>
<id>md_5</id>
</developer>
<developer>
<id>Zartec</id>
</developer>
<developer>
<id>ghac</id>
</developer>
</developers>

<modules>
Expand All @@ -51,17 +57,17 @@
</modules>

<scm>
<connection>scm:git:[email protected]:SpigotMC/BungeeCord.git</connection>
<developerConnection>scm:git:[email protected]:SpigotMC/BungeeCord.git</developerConnection>
<url>[email protected]:SpigotMC/BungeeCord.git</url>
<connection>scm:git:[email protected]:HexagonMC/BungeeCord.git</connection>
<developerConnection>scm:git:[email protected]:HexagonMC/BungeeCord.git</developerConnection>
<url>[email protected]:HexagonMC/BungeeCord.git</url>
</scm>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/SpigotMC/BungeeCord/issues</url>
<url>https://github.com/HexagonMC/BungeeCord/issues</url>
</issueManagement>
<ciManagement>
<system>jenkins</system>
<url>http://ci.md-5.net/job/BungeeCord</url>
<system>travis-ci</system>
<url>https://travis-ci.org/HexagonMC/BungeeCord</url>
</ciManagement>

<properties>
Expand Down
31 changes: 31 additions & 0 deletions protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.md_5.bungee.protocol;

import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -72,6 +73,36 @@ public static byte[] readArray(ByteBuf buf, int limit)
buf.readBytes( ret );
return ret;
}

public static void writeArrayLegacy(byte[] b, ByteBuf buf, boolean allowExtended)
{
// (Integer.MAX_VALUE & 0x1FFF9A ) = 2097050 - Forge's current upper limit
if ( allowExtended )
{
Preconditions.checkArgument( b.length <= ( Integer.MAX_VALUE & 0x1FFF9A ), "Cannot send array longer than 2097050 (got %s bytes)", b.length );
} else
{
Preconditions.checkArgument( b.length <= Short.MAX_VALUE, "Cannot send array longer than Short.MAX_VALUE (got %s bytes)", b.length );
}
// Write a 2 or 3 byte number that represents the length of the packet. (3 byte "shorts" for Forge only)
// No vanilla packet should give a 3 byte packet, this method will still retain vanilla behaviour.
writeVarShort( buf, b.length );
buf.writeBytes( b );
}

public static byte[] readArrayLegacy(ByteBuf buf)
{
// Read in a 2 or 3 byte number that represents the length of the packet. (3 byte "shorts" for Forge only)
// No vanilla packet should give a 3 byte packet, this method will still retain vanilla behaviour.
int len = readVarShort( buf );

// (Integer.MAX_VALUE & 0x1FFF9A ) = 2097050 - Forge's current upper limit
Preconditions.checkArgument( len <= ( Integer.MAX_VALUE & 0x1FFF9A ), "Cannot receive array longer than 2097050 (got %s bytes)", len );

byte[] ret = new byte[ len ];
buf.readBytes( ret );
return ret;
}

public static void writeStringArray(List<String> s, ByteBuf buf)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t

if ( in.isReadable() )
{
throw new BadPacketException( "Did not read all bytes from packet " + packet.getClass() + " " + packetId + " Protocol " + protocol + " Direction " + prot );
throw new BadPacketException( "Did not read all bytes from packet " + packet.getClass() + " " + packetId + " Protocol " + protocol + " Direction " + prot.getDirection().name() );
}
} else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package net.md_5.bungee.protocol;

import io.netty.buffer.ByteBuf;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class MinecraftInput
{

private final ByteBuf buf;

public byte readByte()
{
return buf.readByte();
}

public short readUnsignedByte()
{
return buf.readUnsignedByte();
}

public int readInt()
{
return buf.readInt();
}

public String readString()
{
short len = buf.readShort();
char[] c = new char[ len ];
for ( int i = 0; i < c.length; i++ )
{
c[i] = buf.readChar();
}

return new String( c );
}
}
Loading

0 comments on commit 95c004f

Please sign in to comment.