Checking if a player can be damaged

Discussion in 'Plugin Development' started by bobacadodl, Jul 9, 2012.

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

    bobacadodl

    How would I go about checking if a player can be damaged? I am making a pickpocketing plugin (I know there are several already, but they don't have the features I need). I want to check that both players can be damaged, (neither is in a safe zone) before letting the pickpocketing work. I have searched, but I cannot find any way to check if a player can be damaged.
     
  2. Offline

    CorrieKay

    How are you defining your area?
     
  3. Offline

    bobacadodl

    CorrieKay I'm not exactly defining any areas in the plugin. I just want to check whether either of the 2 players can be damaged in the location where they are. I'm using multiple anti-pvp plugins on my server, such as worldguard and towny. I don't want users to be able to pickpocket in those regions.
     
  4. Offline

    CorrieKay

    You would have to hook into the api of those systems, and check if the location has pvp enabled.

    a (very) brief look around and i cant really find the towny API documentation, but im about 95% sure its out there, along with the world guard api.
     
  5. Offline

    bobacadodl

    Ugh, are you sure you need to use a plugin's api to check? Can't I send fake damage or something to the players and check if the event was cancelled? Or something like that?
     
  6. Offline

    EnvisionRed

    No reason to be reluctant to use the api. It's out there and it provides a fast, simple way to do what you want to do.
     
  7. Offline

    bobacadodl

    EnvisionRed There are many plugins on my server, and many situations in which I don't want players to pickpocket. Example: In Mob Arenas/Pvp Arenas.
     
  8. Offline

    EnvisionRed

    I haven't looked into this but I think you can get a region's name with worldguard, maybe make a list in the config for which regions are allowed for pickpocket?
     
  9. Offline

    bobacadodl

    If you say that there is no way to do this, I guess I could workaround it and use the APIs, but if anyone knows how to do this, please comment!

    EnvisionRed I was thinking of creating a pickpocket region flag. I know world guard's api lets you create custom flags.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  10. Offline

    Colby l

    I know this is an old post, however Towny's API is horrendous, and the plugin itself is horribly built. It follows little to no proper programming practices, and it's hell hooking into it.
     
  11. Offline

    Alshain01

    You can use the Flags api to easily get the information from a wide array of plugins. However I have a policy against plugins not on BukkitDev, so I'm sorry to say Towny isn't one of them.
     
Thread Status:
Not open for further replies.

Share This Page