How to add MultiWorld support to a plugin?

Discussion in 'Plugin Development' started by hoffm59, Jun 1, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    hoffm59

    Hey guys,

    I got some requests to add multiworld support to my plugin.
    Does anyone know a good tutorial or can help me in a few sentences??
    It would be nice :D

    Greez
    hoffm59
     
  2. Offline

    Juze

    Would need this too for my plugin.
     
  3. Offline

    Jayjay110

    Ok let me spell it out for you guys, Multi world support is nothing more than getting different worlds, that said, what do u want multi-world support for, your plugin manager?

    if so, I highly doubt that you can disable certain plugins per worlds because of the fact that its not your plugin you are disabling, you cant just deny access for a plugin to a world, it doesnt work like that, unless say you disable the plugin eveytime a certain world is in use, otherwhise bleh not gonna work.


    If you need help pm me tho?

    What do other people want multi world support for ill talk u through it?

    p.s: if you want to say disable an event inside a certain world, do this:

    if (event.getWorld().getName().toLowerCase().trim() == "nether"){
    //disable it here
    }else{
    //its good to go
    }


    This is just a part from my source in one of my plugins called beanz :p

    Beanz Code (open)

    PHP:
    World world player.getWorld();
            
    String worldname world.getName().toLowerCase().trim();
            if (
    iconomy == true){
                
    double rnd;
                @
    SuppressWarnings("static-access")
                   
    Holdings balance iConomy.getAccount(player.getName().toString()).getHoldings();
                if (
    worldname.equalsIgnoreCase("nether")){
                    
    rnd + (int)(Math.random()*100);
                    
    balance.subtract(rnd);
                    
    say(player,"EGG SALAD!");
                    
    player.sendMessage(ChatColor.RED "You broke all the rules! Suffer now with " rnd " less beanz?");
                }else if (
    worldname.equalsIgnoreCase("beanzland")){
                    
    rnd + (int)(Math.random()*1000000);
                    
    balance.add(rnd);
                    
    say(player,"BEANZ! WHO SAID BEANZ... " player.getName() + " YOU HAVE EARNT URSELF GOOD SHIT!");
                    
    player.sendMessage(ChatColor.AQUA "YOU NOW HAS " rnd " MORE BEANZ?");
                }else{

                    
    rnd + (int)(Math.random()*100);
                    
    balance.add(rnd);

                    
    say(player,"BEANZ!");
                    
    player.sendMessage(ChatColor.AQUA "You have been awarded with " rnd " more beanz?");
                }
            }else{
                if (
    worldname == "nether"){                
                    
    say(player,"EGG SALAD!");
                    
    player.sendMessage(ChatColor.RED "You broke all the rules! Suffer now with less beanz? Oh DAMN ur lucky, iConomy is disabled!");
                }else if (
    worldname == "Beanzland"){
                    
    say(player,"BEANZ! WHO SAID BEANZ... " player.getName() + " YOU HAVE EARNT URSELF GOOD SHIT!");
                    
    player.sendMessage(ChatColor.AQUA "OH wait, iConomy is not enabled!");
                }else{

                    
    say(player,"BEANZ!");
                    
    player.sendMessage(ChatColor.AQUA "You have been awarded with... nothing!!! iConomy isnt enabled!");
                }
            }
     
  4. Offline

    hoffm59

    Thanks for your quick reply Jayjay110 ;)
    And yes, it was my plugin manager, that should get multiworld support... but when I think about your words I had to agnize that you are right...
     
  5. Ah, thanks Jayjay110, I didn't know it was as simple as getting the world and event happened on and then seeing if it matched a name :)
     
  6. Offline

    Jayjay110

    :) its all good :p
     
Thread Status:
Not open for further replies.

Share This Page