Closed Dizover closed 1 year ago
I am unsure if we currently support multiple destinations, though it wouldn't be hard to make it support a list of destinations e.g. portal1,portal2,portal3,portal4
If you are able to code or at least know how to make minimal edits you may be able to sort it before I get a chance to compile it.
https://github.com/sekwah41/Advanced-Portals/blob/10c009b4855d65d975119b459b21e0b9ad3aaae1/src/main/java/com/sekwah/advancedportals/bukkit/portals/Portal.java#L542-L551 this is where you would do it.
I may be able to sort you out a copy that can go to random locations on a list tomorrow, though I have a lot going on.
Essentially the line you would need would be
String[] destinations = portal.getDestiation().split(",");
destination = destinations[random.nextInt(destinations.length)];
and then replace the references to portal.getDestiation()
with destination
Actually, I just did a test compiling it through github, try to give that a try. There is a chance it'll just error though should be fine. Advanced-Portals-Desti.zip
I launched the plugin on the server, and tried to make a portal that leads to different destinations, as you wrote in the example, but in my case destination:dest1,dest2,dest3 but it says that such a destination does not exist. Have you already implemented this feature with random teleportation or are you just going to implement it?
I'm not a programmer at all so I rewrote the code using chatgpt and got this
} else if (portal.getDestiation() != null) { ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml"); String[] destinations = portal.getDestiation().split(","); if (destinations.length > 0) { Random random = new Random(); String destination = destinations[random.nextInt(destinations.length)]; if (configDesti.getConfig().getString(destination + ".world") != null) { warped = Destination.warp(player, destination, portal, hasMessage, false); if (!warped) { if(doKnockback) throwPlayerBack(player); } } } } else if (showFailMessage) {
Replaced the necessary lines and compiled and upload on server, and reboot server, but when i run this commsnd /portal create name:portal1test1 triggerblock:WATER destination:dest1,dest2,dest3
it wrote to me destination: dest1,dest2,dest3 (destination does not exist)
While im updating the release mechanism, this should help you :) Multi desti.zip
Thank you very much, as for me, the function of random teleportation to different destinations is the base
Does your plugin have a teleportation function to random places marked by the server administrator? So that the player can move around the portals like here in this image. If yes, please write how to do it.