feat: allow random destinations split by ,
This commit is contained in:
parent
10c009b485
commit
15d99fff8c
|
@ -515,10 +515,12 @@ public class Portal {
|
||||||
|
|
||||||
if (portal.getDestiation() != null) {
|
if (portal.getDestiation() != null) {
|
||||||
if(plugin.isProxyPluginEnabled()) {
|
if(plugin.isProxyPluginEnabled()) {
|
||||||
|
String[] destinations = portal.getDestiation().split(",");
|
||||||
|
String destination = destinations[random.nextInt(destinations.length)];
|
||||||
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
||||||
outForList.writeUTF(BungeeMessages.ENTER_PORTAL);
|
outForList.writeUTF(BungeeMessages.ENTER_PORTAL);
|
||||||
outForList.writeUTF(bungeeServer);
|
outForList.writeUTF(bungeeServer);
|
||||||
outForList.writeUTF(portal.getDestiation());
|
outForList.writeUTF(destination);
|
||||||
outForList.writeUTF(player.getUniqueId().toString());
|
outForList.writeUTF(player.getUniqueId().toString());
|
||||||
|
|
||||||
player.sendPluginMessage(plugin, BungeeMessages.CHANNEL_NAME, outForList.toByteArray());
|
player.sendPluginMessage(plugin, BungeeMessages.CHANNEL_NAME, outForList.toByteArray());
|
||||||
|
@ -540,9 +542,11 @@ public class Portal {
|
||||||
// Down to bungee to sort out the teleporting but yea theoretically they should
|
// Down to bungee to sort out the teleporting but yea theoretically they should
|
||||||
// warp.
|
// warp.
|
||||||
} else if (portal.getDestiation() != null) {
|
} else if (portal.getDestiation() != null) {
|
||||||
|
String[] destinations = portal.getDestiation().split(",");
|
||||||
|
String destination = destinations[random.nextInt(destinations.length)];
|
||||||
ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml");
|
ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
if (configDesti.getConfig().getString(portal.getDestiation() + ".world") != null) {
|
if (configDesti.getConfig().getString(destination + ".world") != null) {
|
||||||
warped = Destination.warp(player, portal.getDestiation(), portal, hasMessage, false);
|
warped = Destination.warp(player, destination, portal, hasMessage, false);
|
||||||
if (!warped) {
|
if (!warped) {
|
||||||
if(doKnockback)
|
if(doKnockback)
|
||||||
throwPlayerBack(player);
|
throwPlayerBack(player);
|
||||||
|
|
Loading…
Reference in New Issue