Development Assistance Disable a plugin for one world

Discussion in 'Plugin Help/Development/Requests' started by metincasper, Sep 11, 2015.

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

    metincasper

    Hi Guys

    If we say that a plugin contains 4 plugins, a,b,c and d. these plugins are all at one server.
    On this server i got 4 worlds, A, B,C and D.

    There 2 players, player1 and player2.
    Player1 is in map A and then only the plugin a is working for him. In the same time as player1 is in map A player2 is in map B and only the plugin b is working for player2. Then when player1 goes to map D only the plugin d is working for player1.

    I've seen a plugin do this in the onEnable() method but i can't figure out how and if it's even in the onEnable() method?

    I don't say you have to give me all the code, but just give me some hints so i can make it myself.

    Thank you!
     
  2. Offline

    Halmerson

    In your onEnable() try putting maybe Bukkit.get world("a");
     
  3. Offline

    metincasper

    @Halmerson should i then get something like Bukkit.getWorld("A").disableplugin(a)?
     
  4. Offline

    Halmerson

    @metincasper
    Perhaps. I'm just giving my thought, but in the end, its your plugin and you can do whatever you want.

    Go ahead and try disableplugin(a) because I haven't even tested my method so you are probably right.

    Also, in the Bukkit.getworld("a"), the ("a") part you must have the exact world name I beleive., but maybe not.
     
  5. Offline

    metincasper

    @Halmerson hmm... i will try to take a look at the methods :) Thank you so fare
     
  6. Offline

    Halmerson

    @metincasper
    Np, problem (so far xD)
    I'm not 100% sure that it will work though so good luck
     
  7. Offline

    metincasper

    @Halmerson I think i have to look at the pluginManager method to see if there is anything there i can use
     
  8. Offline

    Halmerson

  9. Offline

    metincasper

    @Halmerson so now i made this up:


    Code:
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            p.sendMessage(p.getDisplayName());
            if (p.getDisplayName().equalsIgnoreCase("xXCalleManXx")) {
                p.sendMessage("Okay");
                p.getServer().getPluginManager().disablePlugins();
                p.getServer().getPluginManager().enablePlugin(this);
            }else{
                p.sendMessage("nej");
            }
        }
    But that disable all plugins but not it own for all players and not just for 'xXCalleManXx'
     
  10. Offline

    teej107

    @metincasper There is no simple way to disable plugins for certain worlds. You can however manipulate the events by checking the world they are happening in and prevent them from even being fired!
     
    metincasper likes this.
Thread Status:
Not open for further replies.

Share This Page