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:
commit
27032ac2ed
@ -46,9 +46,7 @@ public class Portal extends MiniPlugin
|
|||||||
|
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
|
||||||
|
|
||||||
String host = "10.33.53.16"; //plugin.getConfig().getString("serverstatus.connectionurl");
|
_repository = new PortalRepository();
|
||||||
int port = 6379;
|
|
||||||
_repository = new PortalRepository(host, port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAllPlayers(String serverName)
|
public void SendAllPlayers(String serverName)
|
||||||
@ -119,7 +117,7 @@ public class Portal extends MiniPlugin
|
|||||||
{
|
{
|
||||||
public void run()
|
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 ServerCommand(this));
|
||||||
AddCommand(new SendCommand(this));
|
AddCommand(new SendCommand(this));
|
||||||
}
|
}
|
||||||
boolean sent = false;
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void checkForServerTransfers(UpdateEvent event)
|
public void checkForServerTransfers(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().length == 0)
|
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().length == 0)
|
||||||
return;
|
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;
|
_retrieve = !_retrieve;
|
||||||
/*
|
|
||||||
if (_retrieve)
|
if (_retrieve)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||||
@ -208,6 +195,5 @@ public class Portal extends MiniPlugin
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import mineplex.serverdata.ServerManager;
|
||||||
import mineplex.serverdata.Utility;
|
import mineplex.serverdata.Utility;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
@ -25,12 +26,11 @@ public class PortalRepository
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* 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();
|
String serializedData = response.get();
|
||||||
ServerTransfer serverTransfer = Utility.deserialize(serializedData, ServerTransfer.class);
|
ServerTransfer serverTransfer = Utility.deserialize(serializedData, ServerTransfer.class);
|
||||||
System.out.println("got transfer : " + serverTransfer.getPlayerName() + " -> " + serverTransfer.getServerName());
|
|
||||||
serverTransfers.add(serverTransfer);
|
serverTransfers.add(serverTransfer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ import java.util.Map;
|
|||||||
public class ServerManager
|
public class ServerManager
|
||||||
{
|
{
|
||||||
// The host of the default redis database used for server repository
|
// 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
|
// 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
|
// The cached repository instances
|
||||||
private static Map<Region, ServerRepository> repositories = new HashMap<Region, ServerRepository>();
|
private static Map<Region, ServerRepository> repositories = new HashMap<Region, ServerRepository>();
|
||||||
|
Loading…
Reference in New Issue
Block a user