Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

Conflicts:
	Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java
	Plugins/Mineplex.Core/src/mineplex/core/portal/PortalRepository.java
This commit is contained in:
Jonathan Williams 2014-08-13 18:59:59 -05:00
commit 27032ac2ed
3 changed files with 10 additions and 25 deletions

View File

@ -46,9 +46,7 @@ public class Portal extends MiniPlugin
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
String host = "10.33.53.16"; //plugin.getConfig().getString("serverstatus.connectionurl");
int port = 6379;
_repository = new PortalRepository(host, port);
_repository = new PortalRepository();
}
public void SendAllPlayers(String serverName)
@ -119,7 +117,7 @@ public class Portal extends MiniPlugin
{
public void run()
{
//_repository.addServerTransfer(new ServerTransfer(playerName, serverName));
_repository.addServerTransfer(new ServerTransfer(playerName, serverName));
}
});
}
@ -151,26 +149,15 @@ public class Portal extends MiniPlugin
AddCommand(new ServerCommand(this));
AddCommand(new SendCommand(this));
}
boolean sent = false;
@EventHandler
public void checkForServerTransfers(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().length == 0)
return;
// DEBUG CODE - REMOVE THIS
if (Bukkit.getOnlinePlayers().length > 0 && !sent)
{
Player player = Bukkit.getOnlinePlayers()[0];
if (player.isSneaking())
{
System.out.println("Debug transferring player " + player.getName());
AddTransferRecord(player.getName(), "TEST-2");
sent = true;
}
}
_retrieve = !_retrieve;
/*
if (_retrieve)
{
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
@ -208,6 +195,5 @@ public class Portal extends MiniPlugin
}
});
}
*/
}
}

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import mineplex.serverdata.ServerManager;
import mineplex.serverdata.Utility;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
@ -25,12 +26,11 @@ public class PortalRepository
/**
* Class constructor
* @param host - the host name connection URL for the repository database
* @param port
*/
public PortalRepository(String host, int port)
public PortalRepository()
{
this._jedisPool = new JedisPool(new JedisPoolConfig(), host, port);
this._jedisPool = new JedisPool(new JedisPoolConfig(), ServerManager.DEFAULT_REDIS_HOST,
ServerManager.DEFAULT_REDIS_PORT);
}
/**
@ -61,7 +61,6 @@ public class PortalRepository
{
String serializedData = response.get();
ServerTransfer serverTransfer = Utility.deserialize(serializedData, ServerTransfer.class);
System.out.println("got transfer : " + serverTransfer.getPlayerName() + " -> " + serverTransfer.getServerName());
serverTransfers.add(serverTransfer);
}
}

View File

@ -12,10 +12,10 @@ import java.util.Map;
public class ServerManager
{
// The host of the default redis database used for server repository
private static String DEFAULT_REDIS_HOST = "10.33.53.16";
public final static String DEFAULT_REDIS_HOST = "10.33.53.16";
// The default port used by redis databases
private static int DEFAULT_REDIS_PORT = 6379;
public final static int DEFAULT_REDIS_PORT = 6379;
// The cached repository instances
private static Map<Region, ServerRepository> repositories = new HashMap<Region, ServerRepository>();