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

Commit

Permalink
Merge branch 'SpigotMC-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sleiss committed Dec 27, 2018
2 parents 367a127 + 1cf1651 commit 38f75ab
Show file tree
Hide file tree
Showing 43 changed files with 1,004 additions and 142 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ This version reimplements Minecraft 1.7.10 and basic 1.7.10 Forge support.

Since release 134+, SpongePls is no longer needed when using Sponge-servers within your network!

<<<<<<< HEAD
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.
=======
### Security warning

As your Minecraft servers have to run without authentication (online-mode=false) for BungeeCord to work, this poses a new security risk. Users may connect to your servers directly, under any username they wish to use. The kick "If you wish to use IP forwarding, please enable it in your BungeeCord config as well!" does not protect your Spigot servers.

To combat this, you need to restrict access to these servers for example with a firewall (please see [firewall guide](https://www.spigotmc.org/wiki/firewall-guide/)).

Source
------
Source code is currently available on [GitHub](https://www.spigotmc.org/go/bungeecord-git).
>>>>>>> 7dd09289ee7aed473caaf228e461f8927c51f1a5
This version is maintained by https://hexagonmc.eu

Expand Down
1 change: 0 additions & 1 deletion api/src/main/java/net/md_5/bungee/api/ServerPing.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import net.md_5.bungee.Util;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.plugin.Event;

/**
* Called when the proxy is pinged with packet 0xFE from the server list.
Expand Down
11 changes: 11 additions & 0 deletions api/src/main/java/net/md_5/bungee/api/plugin/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,15 @@ public Command(String name, String permission, String... aliases)
* @param args arguments used to invoke this command
*/
public abstract void execute(CommandSender sender, String[] args);

/**
* Check if this command can be executed by the given sender.
*
* @param sender the sender to check
* @return whether the sender can execute this
*/
public boolean hasPermission(CommandSender sender)
{
return permission == null || permission.isEmpty() || sender.hasPermission( permission );
}
}
14 changes: 12 additions & 2 deletions api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -143,8 +144,7 @@ public boolean dispatchCommand(CommandSender sender, String commandLine, List<St
return false;
}

String permission = command.getPermission();
if ( permission != null && !permission.isEmpty() && !sender.hasPermission( permission ) )
if ( !command.hasPermission( sender ) )
{
if ( tabResults == null )
{
Expand Down Expand Up @@ -428,4 +428,14 @@ public void unregisterListeners(Plugin plugin)
it.remove();
}
}

/**
* Get an unmodifiable collection of all registered commands.
*
* @return commands
*/
public Collection<Map.Entry<String, Command>> getCommands()
{
return Collections.unmodifiableCollection( commandMap.entrySet() );
}
}
6 changes: 0 additions & 6 deletions bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>4.9</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ public class Bootstrap

public static void main(String[] args) throws Exception
{
if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 51.0 )
if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 52.0 )
{
System.err.println( "*** ERROR *** BungeeCord requires Java 7 or above to function! Please download and install it!" );
System.err.println( "*** ERROR *** BungeeCord requires Java 8 or above to function! Please download and install it!" );
System.out.println( "You can check your Java version with the command: java -version" );
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import net.md_5.bungee.api.chat.ClickEvent.Action;

@Getter
@ToString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.md_5.bungee.api.ChatColor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package net.md_5.bungee.config;

import com.google.common.base.Charsets;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -51,7 +53,7 @@ public Node representData(Object data)
@Override
public void save(Configuration config, File file) throws IOException
{
try ( FileWriter writer = new FileWriter( file ) )
try ( Writer writer = new OutputStreamWriter( new FileOutputStream( file ), Charsets.UTF_8 ) )
{
save( config, writer );
}
Expand All @@ -72,9 +74,9 @@ public Configuration load(File file) throws IOException
@Override
public Configuration load(File file, Configuration defaults) throws IOException
{
try ( FileReader reader = new FileReader( file ) )
try ( FileInputStream is = new FileInputStream( file ) )
{
return load( reader, defaults );
return load( is, defaults );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public void execute(CommandSender sender, String[] args)
sender.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", ( (ProxiedPlayer) sender ).getServer().getInfo().getName() ) );
}

TextComponent serverList = new TextComponent( ProxyServer.getInstance().getTranslation( "server_list" ) );
serverList.setColor( ChatColor.GOLD );
ComponentBuilder serverList = new ComponentBuilder( "" ).append( TextComponent.fromLegacyText( ProxyServer.getInstance().getTranslation( "server_list" ) ) );
boolean first = true;
for ( ServerInfo server : servers.values() )
{
Expand All @@ -55,11 +54,11 @@ public void execute(CommandSender sender, String[] args)
.append( "Click to connect to the server" ).italic( true )
.create() ) );
serverTextComponent.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/server " + server.getName() ) );
serverList.addExtra( serverTextComponent );
serverList.append( serverTextComponent );
first = false;
}
}
sender.sendMessage( serverList );
sender.sendMessage( serverList.create() );
} else
{
if ( !( sender instanceof ProxiedPlayer ) )
Expand Down
3 changes: 3 additions & 0 deletions native/src/main/c/NativeCipherImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Support for CentOS 6
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");

#include <stdlib.h>
#include <string.h>

Expand Down
Binary file modified native/src/main/resources/native-cipher.so
Binary file not shown.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

<properties>
<build.number>unknown</build.number>
<netty.version>4.1.30.Final</netty.version>
<netty.version>4.1.32.Final</netty.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -101,7 +101,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -139,7 +139,7 @@
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java17</artifactId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
Expand Down
25 changes: 23 additions & 2 deletions protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,28 @@
<name>BungeeCord-Protocol</name>
<description>Minimal implementation of the Minecraft protocol for use in BungeeCord</description>

<!-- We really shouldn't depend on external repositories, but at least this is the Central staging one -->
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.16-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
Expand All @@ -33,8 +54,8 @@
</dependency>
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
<artifactId>core</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.md_5.bungee.protocol.packet.ClientStatus;
import net.md_5.bungee.protocol.packet.Login;
import net.md_5.bungee.protocol.packet.Chat;
import net.md_5.bungee.protocol.packet.Commands;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
import net.md_5.bungee.protocol.packet.PlayerListItem;
Expand All @@ -20,6 +21,7 @@
import net.md_5.bungee.protocol.packet.Respawn;
import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.EncryptionResponse;
import net.md_5.bungee.protocol.packet.EntityStatus;
import net.md_5.bungee.protocol.packet.LegacyHandshake;
import net.md_5.bungee.protocol.packet.LegacyPing;
import net.md_5.bungee.protocol.packet.LoginPayloadRequest;
Expand Down Expand Up @@ -158,4 +160,12 @@ public void handle(LoginPayloadRequest request) throws Exception
public void handle(LoginPayloadResponse response) throws Exception
{
}

public void handle(EntityStatus status) throws Exception
{
}

public void handle(Commands commands) throws Exception
{
}
}
13 changes: 13 additions & 0 deletions protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ public static byte[] readArrayLegacy(ByteBuf buf)
return ret;
}

public static int[] readVarIntArray(ByteBuf buf)
{
int len = readVarInt( buf );
int[] ret = new int[ len ];

for ( int i = 0; i < len; i++ )
{
ret[i] = readVarInt( buf );
}

return ret;
}

public static void writeStringArray(List<String> s, ByteBuf buf)
{
writeVarInt( s.size(), buf );
Expand Down
16 changes: 16 additions & 0 deletions protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import net.md_5.bungee.protocol.packet.BossBar;
import net.md_5.bungee.protocol.packet.Chat;
import net.md_5.bungee.protocol.packet.ClientSettings;
import net.md_5.bungee.protocol.packet.Commands;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.EncryptionResponse;
import net.md_5.bungee.protocol.packet.EntityStatus;
import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.KeepAlive;
import net.md_5.bungee.protocol.packet.Kick;
Expand Down Expand Up @@ -177,6 +179,20 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_7_6, 0x46 , false ),
map( ProtocolConstants.MINECRAFT_1_8, 0x46 , false )
);
TO_CLIENT.registerPacket(
EntityStatus.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_12, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_13, 0x1C )
);
if ( Boolean.getBoolean( "net.md-5.bungee.protocol.register_commands" ) )
{
TO_CLIENT.registerPacket(
Commands.class,
map( ProtocolConstants.MINECRAFT_1_13, 0x11 )
);
}

TO_SERVER.registerPacket(
KeepAlive.class,
Expand Down
Loading

0 comments on commit 38f75ab

Please sign in to comment.