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

Rebase to Minecraft 1.11 #9

Open
wants to merge 39 commits into
base: spigot_master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e2a2e19
Change groupId to tc.oc and add our deployment info
tonybruess Sep 7, 2014
114e9b7
Disable security manager
tonybruess Sep 12, 2014
d23b688
Log stderr at WARNING instead of SEVERE
jedediah Nov 19, 2014
b58f1c0
Postpone PluginManager creation so that EventBus gets the right logger
jedediah Nov 27, 2014
83008ed
Log event exceptions at SEVERE level
jedediah Nov 27, 2014
d2d4c55
Improve logging of packet decoding errors
jedediah Nov 28, 2014
12a61c1
A few more packet ID range checks
jedediah Nov 30, 2014
0287453
Ignore a common exception that appears to be harmless
jedediah Dec 13, 2014
aca76c1
Fix NPE caused by the other fix
jedediah Dec 14, 2014
dfbefc1
Remove startup delay for outdated build
jedediah Dec 22, 2014
637b5e9
Add the capability to simulate username changes
jedediah Jan 6, 2015
11939a9
Properly serialize all BaseComponent subclasses
jedediah Feb 13, 2015
790fcc0
Don't set the default log level to ALL
jedediah Aug 31, 2015
c9091ca
Allow commands to dynamically decide if they should be handled or pas…
jedediah Sep 5, 2015
473e67f
Improve component cycle detection
jedediah Oct 3, 2015
1d109a8
Remove parent field from BaseComponent
jedediah Oct 4, 2015
2b8be11
Seems Apache Commons is not available at runtime
jedediah Oct 4, 2015
fd8e6fe
Register PluginLoggers with the LogManager
jedediah Oct 10, 2015
f56d94a
Register root logger with LogManager as well
jedediah Oct 11, 2015
132e8d7
Allow Configuration objects to be cloned
jedediah Jan 16, 2016
56c9497
Safe dynamic modification of the server list
jedediah Jan 24, 2016
1dfbed8
Don't complain about completely irrelevant annotation
jedediah Jan 27, 2016
c26aa8c
Store remote IP in error log records
jedediah Feb 2, 2016
eda0ca7
Handle Ping packets in Status state
jedediah Feb 3, 2016
045198a
Detect more things as bad packets
jedediah Feb 3, 2016
d55b502
Implement minecraft-api
jedediah Feb 4, 2016
ddac4bb
Add selector and score components to chat API
jedediah Mar 5, 2016
71bf876
Various improvements to chat components
jedediah Mar 6, 2016
73111be
Don't autolink the MOTD
jedediah Mar 6, 2016
efc912b
Protocol version API
jedediah Mar 24, 2016
fbdfd0c
Plugins always load classes from their own JAR if present
jedediah Jun 3, 2016
48c2528
Add quiet connect plugin channel message
jedediah Jun 3, 2016
2b4016c
A few helpful methods for converting between components and legacy text
jedediah Jun 3, 2016
1b94bde
Don't throw an exception for unsupported protocols
jedediah Jun 9, 2016
b99a1e6
Implement minecraft-api strict config getters
jedediah Jun 27, 2016
ef44e69
Handle default colors better when converting to/from legacy text
jedediah Jul 6, 2016
951af28
Optionally shutdown if any plugins fail to load
jedediah Jul 24, 2016
93660d0
Sync with minecraft-api
jedediah Sep 23, 2016
38fb4ad
Provide access to exceptions that cause disconnects
jedediah Nov 6, 2016
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
16 changes: 10 additions & 6 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>net.md-5</groupId>
<groupId>tc.oc</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.11-SNAPSHOT</version>
<packaging>jar</packaging>
Expand All @@ -20,25 +19,30 @@

<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<groupId>tc.oc</groupId>
<artifactId>minecraft-api</artifactId>
<version>1.11-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>tc.oc</groupId>
<artifactId>bungeecord-chat</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<groupId>tc.oc</groupId>
<artifactId>bungeecord-config</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<groupId>tc.oc</groupId>
<artifactId>bungeecord-event</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<groupId>tc.oc</groupId>
<artifactId>bungeecord-protocol</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
Expand Down
41 changes: 1 addition & 40 deletions api/src/main/java/net/md_5/bungee/api/CommandSender.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
package net.md_5.bungee.api;

import net.md_5.bungee.api.chat.BaseComponent;

import java.util.Collection;

public interface CommandSender
public interface CommandSender extends tc.oc.minecraft.api.command.CommandSender
{

/**
* Get the unique name of this command sender.
*
* @return the senders username
*/
public String getName();

/**
* Send a message to this sender.
*
* @param message the message to send
*/
@Deprecated
public void sendMessage(String message);

/**
* Send several messages to this sender. Each message will be sent
* separately.
Expand All @@ -31,20 +14,6 @@ public interface CommandSender
@Deprecated
public void sendMessages(String... messages);

/**
* Send a message to this sender.
*
* @param message the message to send
*/
public void sendMessage(BaseComponent... message);

/**
* Send a message to this sender.
*
* @param message the message to send
*/
public void sendMessage(BaseComponent message);

/**
* Get all groups this user is part of. This returns an unmodifiable
* collection.
Expand All @@ -67,14 +36,6 @@ public interface CommandSender
*/
public void removeGroups(String... groups);

/**
* Checks if this user has the specified permission node.
*
* @param permission the node to check
* @return whether they have this node
*/
public boolean hasPermission(String permission);

/**
* Set a permission node for this user.
*
Expand Down
71 changes: 71 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 @@ -32,9 +32,75 @@ public interface ProxyConfig

/**
* Set of all servers.
*
* @deprecated The returned map may be modified concurrently by the proxy.
* The safe alternative is {@link #getServersCopy()}.
*/
@Deprecated
Map<String, ServerInfo> getServers();

/**
* Return all servers registered to this proxy, keyed by name. The returned map
* is an immutable snapshot of the actual server collection. It cannot be modified,
* and it will not change.
*
* @return all registered remote server destinations
*/
Map<String, ServerInfo> getServersCopy();

/**
* Gets the server info of a server.
*
* @param name the name of the configured server
* @return the server info belonging to the specified server
*/
ServerInfo getServerInfo(String name);

/**
* Register the given server to the proxy.
* Any currently registered server with the same name will be replaced.
*
* @return the previously registered server with the same name, or null if there was no such server.
*/
ServerInfo addServer(ServerInfo server);

/**
* Register all of the given servers to the proxy.
*
* @return true if any servers were added or replaced.
*/
boolean addServers(Collection<ServerInfo> servers);

/**
* Un-register the server with the given name from the proxy.
*
* @return the server that was removed, or null if there is no server with the given name.
*/
ServerInfo removeServerNamed(String name);

/**
* Un-register the given server from the proxy.
* The server is matched by name only, other fields in the given {@link ServerInfo} are ignored.
*
* @return the server that was removed, or null if there is no server with a matching name.
*/
ServerInfo removeServer(ServerInfo server);

/**
* Un-register servers with any of the given names from the proxy.
*
* @return true if any servers were removed.
*/
boolean removeServersNamed(Collection<String> names);

/**
* Un-register all of the given servers from the proxy.
* The servers are matched by name only, other fields in the given {@link ServerInfo} are ignored.
*
* @return true if any servers were removed.
*/
boolean removeServers(Collection<ServerInfo> servers);

/**
* Does the server authenticate with mojang
*/
Expand Down Expand Up @@ -79,4 +145,9 @@ public interface ProxyConfig
* The favicon used for the server ping list.
*/
Favicon getFaviconObject();

/**
* Shutdown immediately if any plugins fail to load
*/
boolean isRequireAllPlugins();
}
28 changes: 27 additions & 1 deletion api/src/main/java/net/md_5/bungee/api/ProxyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.scheduler.TaskScheduler;

public abstract class ProxyServer
public abstract class ProxyServer implements tc.oc.minecraft.api.server.LocalServer
{

@Getter
Expand Down Expand Up @@ -87,15 +87,41 @@ public static void setInstance(ProxyServer instance)
*/
public abstract ProxiedPlayer getPlayer(UUID uuid);

@Override
public ProxiedPlayer getPlayerExact(String name)
{
return getPlayer( name );
}

@Override
public Collection<ProxiedPlayer> getOnlinePlayers()
{
return getPlayers();
}

/**
* Return all servers registered to this proxy, keyed by name. Unlike the
* methods in {@link ConfigurationAdapter#getServers()}, this will not
* return a fresh map each time.
*
* @return all registered remote server destinations
*
* @deprecated The returned map is part of the proxy's internal state,
* and may be modified concurrently by the proxy.
* The safe alternative is {@link #getServersCopy()}.
*/
@Deprecated
public abstract Map<String, ServerInfo> getServers();

/**
* Return all servers registered to this proxy, keyed by name. The returned map
* is an immutable snapshot of the actual server collection. It cannot be modified,
* and it will not change.
*
* @return all registered remote server destinations
*/
public abstract Map<String, ServerInfo> getServersCopy();

/**
* Gets the server info of a server.
*
Expand Down
2 changes: 1 addition & 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 @@ -140,7 +140,7 @@ public void setFavicon(Favicon favicon)
@Deprecated
public void setDescription(String description)
{
this.description = new TextComponent( TextComponent.fromLegacyText( description ) );
this.description = new TextComponent( TextComponent.fromLegacyText( description, false ) );
}

@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Class used to represent a server to connect to.
*/
public interface ServerInfo
public interface ServerInfo extends tc.oc.minecraft.api.server.Server
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Locale;
import java.util.Map;
import java.util.UUID;

import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender;
Expand All @@ -14,24 +14,9 @@
* Represents a player who's connection is being connected to somewhere else,
* whether it be a remote or embedded server.
*/
public interface ProxiedPlayer extends Connection, CommandSender
public interface ProxiedPlayer extends Connection, CommandSender, tc.oc.minecraft.api.entity.Player
{

/**
* Gets this player's display name.
*
* @return the players current display name
*/
String getDisplayName();

/**
* Sets this players display name to be used as their nametag and tab list
* name.
*
* @param name the name to set
*/
void setDisplayName(String name);

/**
* Send a message to the specified screen position of this player.
*
Expand Down Expand Up @@ -128,13 +113,6 @@ public interface ProxiedPlayer extends Connection, CommandSender
@Deprecated
String getUUID();

/**
* Get this connection's UUID, if set.
*
* @return the UUID
*/
UUID getUniqueId();

/**
* Gets this player's locale.
*
Expand Down Expand Up @@ -211,4 +189,6 @@ public interface ProxiedPlayer extends Connection, CommandSender
* not occurred for this {@link ProxiedPlayer} yet.
*/
Map<String, String> getModList();

Throwable getDisconnectException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ServerConnectEvent extends Event implements Cancellable
* Cancelled state.
*/
private boolean cancelled;
private String fakeUsername;

public ServerConnectEvent(ProxiedPlayer player, ServerInfo target)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package net.md_5.bungee.api.plugin;

/**
* Thrown from inside a command to tell the proxy to pass the command upstream
*/
public class CommandBypassException extends RuntimeException {

}
2 changes: 1 addition & 1 deletion api/src/main/java/net/md_5/bungee/api/plugin/Listener.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
/**
* Dummy interface which all event subscribers and listeners must implement.
*/
public interface Listener
public interface Listener extends tc.oc.minecraft.api.event.Listener
{
}
16 changes: 14 additions & 2 deletions api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Represents any Plugin that may be loaded at runtime to enhance existing
* functionality.
*/
public class Plugin
public class Plugin implements tc.oc.minecraft.api.plugin.Plugin
{

@Getter
Expand Down Expand Up @@ -50,6 +50,12 @@ public void onDisable()
{
}

@Override
public ProxyServer getServer()
{
return getProxy();
}

/**
* Gets the data folder where this plugin may store arbitrary data. It will
* be a child of {@link ProxyServer#getPluginsFolder()}.
Expand All @@ -61,6 +67,12 @@ public final File getDataFolder()
return new File( getProxy().getPluginsFolder(), getDescription().getName() );
}

@Override
public InputStream getResource(String name)
{
return getResourceAsStream( name );
}

/**
* Get a resource from within this plugins jar or container. Care must be
* taken to close the returned stream.
Expand All @@ -85,7 +97,7 @@ final void init(ProxyServer proxy, PluginDescription description)
this.proxy = proxy;
this.description = description;
this.file = description.getFile();
this.logger = new PluginLogger( this );
this.logger = PluginLogger.get( this );
}

//
Expand Down
Loading