Skip to content

Commit

Permalink
Adicionado
Browse files Browse the repository at this point in the history
  • Loading branch information
eubyt committed Dec 31, 2015
0 parents commit 8a87a81
Show file tree
Hide file tree
Showing 625 changed files with 26,060 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sudo: false
language: java
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
notifications:
email: false
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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.

You may not use the software for commercial software hosting services without
written permission from the author.

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.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
BungeeCord
==========
The most reliable Minecraft server portal suite.
------------------------------------------------
BungeeCord is a piece of Java software which allows a user to link multiple Minecraft servers together, allowing players to teleport between them and access advanced features. This makes it perfect for servers looking to expand their player base and spread across multiple gameplay styles.

History
-------
For a long time developers have tried to create these mythical 'cloud' systems as outlined above. Until now, none of them have succeeded in making a fully open source and reliable 'cloud'. You may have already noticed my quoting of the word 'cloud', and this is one of the last times you will see it in this document. BungeeCord is **NOT** a 'cloud'. The actual meaning of the aforementioned word is quoted below:

>The use of computing resources (hardware and software) that are delivered as a service over a network (typically the Internet).
BungeeCord does not do this and therefore is not a 'cloud'. Please do not refer to it as one, since the owners and operators of real clouds will get very angry, and you will be seen as ignorant and stupid. Instead I encourage you to use the term 'Server Port Suite' or something to that effect.

Installation & Usage
--------------------
For and in depth guide to the installation and usage of BungeeCord you should check the current primary download location. The current link is provided below for your convenience.

<http://www.spigotmc.org/threads/bungeecord.392/>
47 changes: 47 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

<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>

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

<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.8-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeeCord-API</name>
<description>API implemented by the Elastic Portal Suite</description>

<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-config</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-event</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-protocol</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
78 changes: 78 additions & 0 deletions api/src/main/java/net/md_5/bungee/Util.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package net.md_5.bungee;

import com.google.common.base.Joiner;
import java.net.InetSocketAddress;
import java.util.UUID;

/**
* Series of utility classes to perform various operations.
*/
public class Util
{

private static final int DEFAULT_PORT = 25565;

/**
* Method to transform human readable addresses into usable address objects.
*
* @param hostline in the format of 'host:port'
* @return the constructed hostname + port.
*/
public static InetSocketAddress getAddr(String hostline)
{
String[] split = hostline.split( ":" );
int port = DEFAULT_PORT;
if ( split.length > 1 )
{
port = Integer.parseInt( split[1] );
}
return new InetSocketAddress( split[0], port );
}

/**
* Formats an integer as a hex value.
*
* @param i the integer to format
* @return the hex representation of the integer
*/
public static String hex(int i)
{
return String.format( "0x%02X", i );
}

/**
* Constructs a pretty one line version of a {@link Throwable}. Useful for
* debugging.
*
* @param t the {@link Throwable} to format.
* @return a string representing information about the {@link Throwable}
*/
public static String exception(Throwable t)
{
// TODO: We should use clear manually written exceptions
StackTraceElement[] trace = t.getStackTrace();
return t.getClass().getSimpleName() + " : " + t.getMessage()
+ ( ( trace.length > 0 ) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : "" );
}

public static String csv(Iterable<?> objects)
{
return format( objects, ", " );
}

public static String format(Iterable<?> objects, String separators)
{
return Joiner.on( separators ).join( objects );
}

/**
* Converts a String to a UUID
*
* @param uuid The string to be converted
* @return The result
*/
public static UUID getUUID(String uuid)
{
return UUID.fromString( uuid.substring( 0, 8 ) + "-" + uuid.substring( 8, 12 ) + "-" + uuid.substring( 12, 16 ) + "-" + uuid.substring( 16, 20 ) + "-" + uuid.substring( 20, 32 ) );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package net.md_5.bungee.api;

import com.google.common.base.Preconditions;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;

public abstract class AbstractReconnectHandler implements ReconnectHandler
{

@Override
public ServerInfo getServer(ProxiedPlayer player)
{
ServerInfo server = getForcedHost( player.getPendingConnection() );
if ( server == null )
{
server = getStoredServer( player );
if ( server == null )
{
server = ProxyServer.getInstance().getServerInfo( player.getPendingConnection().getListener().getDefaultServer() );
}

Preconditions.checkState( server != null, "Default server not defined" );
}

return server;
}

public static ServerInfo getForcedHost(PendingConnection con)
{
if ( con.getVirtualHost() == null )
{
return null;
}

String forced = con.getListener().getForcedHosts().get( con.getVirtualHost().getHostString() );

if ( forced == null && con.getListener().isForceDefault() )
{
forced = con.getListener().getDefaultServer();
}
return ProxyServer.getInstance().getServerInfo( forced );
}

protected abstract ServerInfo getStoredServer(ProxiedPlayer player);
}
19 changes: 19 additions & 0 deletions api/src/main/java/net/md_5/bungee/api/Callback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.md_5.bungee.api;

/**
* Represents a method which may be called once a result has been computed
* asynchronously.
*
* @param <V> the type of result
*/
public interface Callback<V>
{

/**
* Called when the result is done.
*
* @param result the result of the computation
* @param error the error(s) that occurred, if any
*/
public void done(V result, Throwable error);
}
93 changes: 93 additions & 0 deletions api/src/main/java/net/md_5/bungee/api/CommandSender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package net.md_5.bungee.api;

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

import java.util.Collection;

public interface 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.
*
* @param messages the messages to send
*/
@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.
*
* @return the users groups
*/
public Collection<String> getGroups();

/**
* Adds groups to a this user for the current session only.
*
* @param groups the groups to add
*/
public void addGroups(String... groups);

/**
* Remove groups from this user for the current session only.
*
* @param groups the groups to remove
*/
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.
*
* @param permission the node to set
* @param value the value of the node
*/
public void setPermission(String permission, boolean value);

/**
* Get all Permissions which this CommandSender has
*
* @return a unmodifiable Collection of Strings which represent their
* permissions
*/
public Collection<String> getPermissions();
}
Loading

0 comments on commit 8a87a81

Please sign in to comment.