Solved is it possible...

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

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


    I asked a friend if it was possible and while he said yes, im still not 100% sure if its accually possible...

    I asked him, is it possible for any plugin not directly related to plugins like essentials with an outside plugin to access the userdata of essentials and check if someones godmode is true, then turn it false,

    So lets say i make a minigame where in other worlds people may use godmode but i want to disallow this in certain area's that another plugin lets call it ... GodChecker, to go into essentials userdata <uuid>.yml then look for godmode.
    If true set false and disallow the command /godmode in that region or world?
  2. Offline

    timtower Moderator Moderator

    @Scorpionvssub You can disallow the command, but finding the plugin handling the effect would be tricky, loads of plugins to check.
  3. Offline


    he said something about loading the yml but that seems too easy.. i know plugins that are capeable of turning off plugins and reloading them, but going into their "private" ymls seems invasion to me it seems weird but i guess stranger things are happening through plugins X)
  4. Offline

    timtower Moderator Moderator

    @Scorpionvssub Please use the tahg or reply button when responding to somebody, then they get notified about it.
    And I have plugins where you can mess in the YML what you want, but that won't change what is loaded in the plugin already.
  5. Offline


    @Scorpionvssub @timtower OP could get a plugin made that checks the world they're in when they go to a new world. If they're in the world that OP doesn't want people to have god mode in, then OP could block the command in that world with WorldGuard (/rg f __global__ blocked-cmds god) and have console run "god <name> off" which will set god mode to off for that player, not toggle it :)
    timtower likes this.
  6. Offline


    Open source, open marrage concept for bukkit - any plugin can see anywhere within your userspace for the server - but not outside of that. So any plugin can go up one level, go into another folder, and go down into their config to find a file as easily as it can look within its own subfolders for a file. Room for malicious files? Youbetcha. suprised that more fake plugins dont include overwriting nocheatplus with a doors-wide-open configuration file so that even when the malicious plugin is removed later, the lasting damage on a system is still propping the door open.

    But as tim mentions, the essentials yml data is just the snapshot of data for essentials to load, and to change, and the yml file is effectively read-only to the other plugin, writing any data to it wont change the godmode state that essentials loaded into memory and is working with - it doesn't check the file each time it needs to see if its in godmode, it does once, when loading, and only if the state changes by godmode command, will it update the file, but updating the file does not trigger the in-memory state...
  7. Offline


    no what i wanted is: like essentials has /whois <player> shows gm godmode muted yes/no and all that info. What i mean is can my plugin Check if a <player> has godmode true then run god <player> off from console on that player meaning it would run the command from essentials via another plugin(kinda like those randomized plugins such as a crate or vote listener).

    So basicly, go into essentials <player uuid>.yml check godmode = true/false if true run god <player> off
  8. Offline


    No point in checking, just run /god <player> off every time.
  9. Offline


    Thanks all, for the advice, i went ahead and as oceantheskatr adviced made a join and world change event to enable and disable godmode respectivly, even though it says "godmode enabled" it does what the intention was :D

    @Boomer Yea merely ment if a plugin was able to go into another plugins personal files like userdata for essentials or a plugin called pointsystem im working on to just read stuff off, so that then like...

    Lets say i managed to make 2-3 minigame that uses points but i want those plugins to use the same points based system but not having each single plugin having its own storage its own point managment but exacly the same source(so to speak) so if u earn 10 points in spleef and do /points it says u have 10 points then i wanna play Parkour which is a different plugin and requires 10 points to unlock an arena it checks if you have 10 points and if so performs a command related to the points plugin to remove 10 points.

    EDIT by Timtower: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Sep 14, 2015
    oceantheskatr likes this.
  10. Offline


    any plugin can access the datafiles of any other plugin within the same server, if the files are stored on the drive - even if the data is stored in an sqllite file or mysql database, as long as it knows 1) the relative path from the plugins folder -- ie /esssentials/userdata/ or /mondoplugin/worlds/world1/inventories/ where the files are stored, 2) the filenames 3) the structure of the datastorage { If its mysql, knowing the database location (file/url), authentication info, and table names used by that plugin is required information for the newer plugins to know/access; you need to know the structure of the tables the other plugin uses, and can then write any sql-connections/query methods to pull and push data to/from those tables yourself. } Then any file can be specified relative to a plugin datafolder as "../otherplugin/otherplugindatafolders/" There is also I think a way to get the system folder for bukkit, and it would then be "/plugins/otherplugin/etc"

    For what you're describing with multiple systems sharing the same point system, a database would be the best solution, or a centralized folder, or best, a separate plugin that just does the score getting and setting, and has an api to let you pass to and get from that you put in your other plugins - if you're in control of them. Trying to hook many things into someone elses preexisting plugin and modify files can be risky if that plugin changes during an upgrade, or outright breaks and isn't updated, but you've built a dependancy of your other systems on it. Making a common core for the others to hook into much better.

    You still run into an issue with reading other files as being dependant on the same 'how does it deal with data' mechanism - some plugins out there will only store player data changes in memory, until the player logs out or the server shuts down - so you could have the player (total score 15) score points in the native plugin (Add 3 points - player has 18 according to that plugin), score points in a different plugin (you want to award 4 points), read the file from the other plugin (which still has 15, the amount loaded when he logged in earlier) , increase the score appropriately (added the 4) , making his file 19. File says 19 points, game thinks he has 18 points. Player logs out, plugin writes out the 18 from memory to the datafile overwriting your 19 point change....

    If you are dealing with a plugin that updates a database or file after each change, then you dont have to worry about updating the datafile by reading and adding values to it by some other plugin - however, you're still limited by a mechanism of 'how does the GAME display the total points at that moment - it only knows for that first plugin the value saved in the file due to saving the changes that occur in memory first, or uplon loading at login - unless you kick the player out as soon as you give him more points.

    So bottom line - tapping into someone elses preexisting scoring plugin, can work, but likely wont due to logicstics of reflecting that change; But if you make a plugin specifically to be that common-core for other plugins that you control to make use of - absolutely, they can share that data and you have a way to force the results to be updated
Thread Status:
Not open for further replies.

Share This Page