Just need to add default permissions and we are ready for release.

This commit is contained in:
md_5 2013-01-22 10:39:21 +11:00
parent 4b9b2cbb96
commit ade3fe4311
4 changed files with 31 additions and 8 deletions

View File

@ -89,7 +89,7 @@ public class BungeeCord extends ProxyServer
public final PluginManager pluginManager = new PluginManager();
@Getter
@Setter
private ReconnectHandler reconnectHandler = new YamlReconnectHandler();
private ReconnectHandler reconnectHandler;
@Getter
@Setter
private ConfigurationAdapter configurationAdapter = new YamlConfig();
@ -104,6 +104,10 @@ public class BungeeCord extends ProxyServer
getPluginManager().registerCommand(new CommandIP());
getPluginManager().registerCommand(new CommandAlert());
getPluginManager().registerCommand(new CommandBungee());
registerChannel("BungeeCord::Disconnect");
registerChannel("BungeeCord::Connect");
registerChannel("BungeeCord::Forward");
}
public static BungeeCord getInstance()
@ -148,6 +152,7 @@ public class BungeeCord extends ProxyServer
public void start() throws IOException
{
config.load();
reconnectHandler = new YamlReconnectHandler();
isRunning = true;
File plugins = new File("plugins");

View File

@ -118,6 +118,7 @@ public class InitialHandler implements Runnable, PendingConnection
} catch (Exception ex)
{
disconnect("[Proxy Error] " + Util.exception(ex));
ex.printStackTrace();
}
}

View File

@ -18,10 +18,10 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import lombok.Getter;
import lombok.Synchronized;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ListenerInfo;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.ServerConnectEvent;
@ -77,7 +77,7 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
if (server == null)
{
// First join
ProxyServer.getInstance().getPlayers().add(this);
BungeeCord.getInstance().connections.put(name, this);
ProxyServer.getInstance().getTabListHandler().onConnect(this);
}
@ -118,6 +118,7 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
}
server.disconnect("Quitting");
server.getInfo().removePlayer(this);
Packet1Login login = newServer.loginPacket;
serverEntityId = login.entityId;
@ -127,8 +128,6 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
// Reconnect process has finished, lets get the player moving again
reconnecting = false;
// Remove from the old by server list
server.getInfo().removePlayer(this);
// Add to new
target.addPlayer(this);
@ -141,8 +140,8 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
destroySelf(ex.getMessage());
} catch (Exception ex)
{
destroySelf("Could not connect to server - " + ex.getClass().getSimpleName());
ex.printStackTrace(); // TODO: Remove
destroySelf("Could not connect to server - " + ex.getClass().getSimpleName());
}
}
@ -377,6 +376,20 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
short len = in.readShort();
byte[] data = new byte[len];
in.readFully(data);
if (target.equals("ALL"))
{
for (String s : BungeeCord.getInstance().getServers().keySet())
{
Server server = BungeeCord.getInstance().getServer(s);
server.sendData(channel, data);
}
} else
{
Server server = BungeeCord.getInstance().getServer(target);
server.sendData(channel, data);
}
break;
case "BungeeCord::Connect":
ServerInfo server = BungeeCord.getInstance().config.getServers().get(in.readUTF());

View File

@ -25,9 +25,13 @@ public class YamlReconnectHandler implements ReconnectHandler
@SuppressWarnings("unchecked")
public YamlReconnectHandler()
{
try (FileReader rd = new FileReader(file))
try
{
data = yaml.loadAs(rd, Map.class);
file.createNewFile();
try (FileReader rd = new FileReader(file))
{
data = yaml.loadAs(rd, Map.class);
}
} catch (IOException ex)
{
ProxyServer.getInstance().getLogger().log(Level.WARNING, "Could not load reconnect locations", ex);