Giter VIP home page Giter VIP logo

Comments (6)

sekwah41 avatar sekwah41 commented on July 16, 2024

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.

} else if (portal.getDestiation() != null) {
ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml");
if (configDesti.getConfig().getString(portal.getDestiation() + ".world") != null) {
warped = Destination.warp(player, portal.getDestiation(), portal, hasMessage, false);
if (!warped) {
if(doKnockback)
throwPlayerBack(player);
}
}
} else if (showFailMessage) {
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

from advanced-portals.

sekwah41 avatar sekwah41 commented on July 16, 2024

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

from advanced-portals.

Dizover avatar Dizover commented on July 16, 2024

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?

from advanced-portals.

Dizover avatar Dizover commented on July 16, 2024

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)

from advanced-portals.

sekwah41 avatar sekwah41 commented on July 16, 2024

While im updating the release mechanism, this should help you :)
Multi desti.zip

from advanced-portals.

Dizover avatar Dizover commented on July 16, 2024

Thank you very much, as for me, the function of random teleportation to different destinations is the base

from advanced-portals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.