{question} random teleportation to different pre-marked places
Dizover opened this issue ยท 6 comments
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.
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