[REQ] Land claims using the command block

Discussion in 'Archived: Plugin Requests' started by brettnicholas, Nov 12, 2012.

  1. Offline

    brettnicholas

    My friends and I are creating a map based somewhat on a tower control system. In the beginning of a game, no towers are controlled and when it starts, we would like to set up a system in which at the tops of the towers are three buttons: to declare peace, to declare war, to claim the tower. In war, PvP is allowed and the towers can be entered freely. In peace, no PvP is allowed is the towers cannot be entered freely. And when the tower is claimed, the person who claims it gets bonuses and the chests within the tower can no longer be opened and blocks cannot be broken.

    The "Factions" plugin works very similarly, but I don't like the power system that is in effect and do not know a way around it. Also, land claims must be done through the console and cannot be done by pressing a button or pulling a lever. If a plugin exists that would allow me to work with and tweak such a system, I would love to know.

    Thank you!
     
  2. Offline

    spazymcgee

    I could not find a plugin to do this so I went ahead and coded one really fast,

    it adds a command /f blockclaim <player name> which can not be used by a player but can be by the server (command block)

    in the block you would put /f blockclaim @p

    give me any feedback you have

    This was developed for 1.4.2 beta build and also has the source included.

    here is the link

    https://www.dropbox.com/s/2a1bjx3m69wz2lh/FactionBlock.jar

    edit: i failed to mention that this is an addition to factions, not a replacement. and that I have not yet disabled the default factions claim command, so you might want ensure that people don't abuse it through administrative observation
     
  3. Offline

    brettnicholas

    That works perfectly, and I appreciate the time that you put into it. The only problem is that I still can't define an exact area to be claimed because (I think) it still relies on the power system which Factions uses, limiting the amount of land that any one person can claim. What would be ideal is if Factions allowed the use of command blocks for every command and allowed me to remove the power system and define the exact dimensions being claimed. I suppose I could simply make the towers each fit in a chunk, since I believe that is how factions defines areas of protection.

    Ideally, three commands would be needed for the map we're making:

    1. Claim land. A button is pressed to claim ownership of pre-defined land, granting ownership of all of the blocks and chests in the land which no one else can now break. Also, a slight bonus would be given when standing in your own land.

    2. Start war. War removes any block/chest protection from the tower.

    3. Start peace. Peace brings back any block/chest protection.

    I'll have to learn to code :p

    Thank you again though
     
  4. Offline

    spazymcgee

    It actually does bypasses the power checking, (if you want to know the code, power checking runs a command check method,something like fplayer.canclaimforfaction, before actually calling the claim event, i just had mine call the claim event without running this check) but it does only do one chunk at a time. this is evidenced by the fact that you can claim land for your faction if your power is 0, and even negative. there is a land claim with radius command that I could use, however.

    I can look into hooking into the claim land cmd with a radius tomorrow. And the bonus can be given by messing with factions built in configuration.

    as for the other two,

    are you asking for war to reset ownership (I.E set everything in the area back to wilderness) of the area effected by the tower,because that would automatically remove block/chest protection unless you are also using a chest protection plugin like lwc, or globally (across all towers).

    I am also not complely sure what you want peace to do, because if everything starts as wilderness, all chests should have no protection unless the tower is claimed by one faction or another.

    it seems like claiming the land is doing the same thing as peace (protecting blocks and chests unless the claim button on the top of the tower is clicked) so im not sure exactly why you would need both.

    I can defiantly improve the first part though, and can work on the second two if i can figure out exactly what it is that you need.

    I couldn't fall asleep so i wen't ahead and got the radius part working.

    now you can do /f blockclaim @p r

    and put in a number for r

    and the area in a square around the player is claimed (I've tested with values up to 100 chunks, so power is defiantly no longer an issue although disbanding a faction with this much territory freezes the server for a few seconds).

    the square is the radius in chunks + the inner block where the cmd block is

    for example /f blockclaim @p 2 will claim an area like this

    x x x x x
    x x x x x
    x x c x x
    x x x x x
    x x x x x

    where c is the command block in the center (and is also claimed as well)

    I can easily change how this works to make r=2 work like this if you want me too, just let me know

    x x x
    x c x
    x x x

    the link should still be the same and you can still do /f blockclaim @p to do a 1 chunk area if you want to

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

    brettnicholas

    Ignoring the peace and war for now, because I really don't even think they might be needed now that you mentioned it, I still can't seem to get the radius to work correctly. I can put in /f blockclaim @p 100 for an extreme example and still, a few blocks away it tells me that I'm in wilderness.

    Everything you have done is awesome, and I really appreciate it. The only other thing I could ask is for the ability to join a faction using command blocks. If I knew you, I would buy you a cup of coffee. Or ten, or whatever other beverage you prefer
     
  6. Offline

    spazymcgee

    hmm could you send me your plugins folder so I can test it with your settings, because it seems to be working fine for me, and yes I believe I can make you join a faction with command blocks I'll do that sometime this afternoon.

    here are the pictures of what it looks like for me, so I could really use your setup
    edit: maby you where not in a faction when you activated it, if you are not in a faction it does nothing.





    2012-11-13_18.31.59.png 2012-11-13_18.32.08.png
     
  7. Offline

    brettnicholas

    I was in a faction, but I'll edit this post with my plugins folder once I can find a site to upload it to since I don't have a dropbox account. It's claims land, it just appears to still be limited regardless of the radius entered.

    Edit: I lied, and made an account.

    https://www.dropbox.com/s/b5p3d4j0hvok1u9/plugins.zip
     
  8. Offline

    spazymcgee

    it seems like you have the old version before i added the radius. Check this file.
    edit:When you claim it should say (<playername> claimed land for <faction name> from <other faction> from <location> to <location2>) with the two locations being in chunks

    edit2: i attached a zip file here, but its not showing up on my side. also my dropbox service was not actually on so it might not have synced with the website, ergo the old version. if you don't see the .zip, try this link https://www.dropbox.com/s/2a1bjx3m69wz2lh/FactionBlock.jar (as i don't know if it changed)
     

    Attached Files:

  9. Offline

    brettnicholas

    Ah, okay. I'll try it out now. I had never checked the version prior to when you added the radius so I assumed that 1.2 was with the radius added. I'll update soon.
     
  10. Offline

    spazymcgee

    wow i forgot about that, 1.2 was left over from an earlier plugin that i copied the general shell from, ill fix that when i add the join cmd

    ok i am pretty sure i got the join to work.
    the cmd is /f blockjoin <faction name> @p
    new version number should be 2.0
    I checked and the link is the same and dropbox updated

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

    brettnicholas

    Just tested everything and it all works as described. I wasn't expecting this much help but I appreciate it a lot. If there was something I could do in return I would love to but I'm not sure I can :p

    Thank you again!

    Edit: Actually, one final thing that I just thought of. Could you possibly allow the use of the command block to claim a radius to warzone? That way I could possibly do some redstone magic under the map and create a system in which each tower pulls a level, completing the circuit and activating warzone for an entire radius.
     
  12. Offline

    spazymcgee

    ok /f blockclaim has been updated

    you can now claim for a specific faction such as <warzone>, however i did run into a certain problem that i will work with

    /f blockclaim @p <radius> <faction> is now possible

    leaving out faction or putting in a bad value will claim for the player's faction

    the problem is that the location around which to claim needed to be based off of the location of the player clicking the button(cause i cant seem to find how to get the location of the actuall command block)

    possibilities for a fix would be manually entering in two x,z positions into the cmd block to claim between (or the position of the command block and a radius), using cmds like world edit does to store the two positions (like /f blockp1 && /f blockp2) which would only work for 1 block, or getting the location of the block in some way that i am overlooking.

    The download link remains the same:)

    also don't worry about the effort, i develop this because I want to, and like developing my java skills. It is a nice challenge for me and I find it fun.
     
  13. Offline

    brettnicholas

    Entering in the two x,z positions or the position of the command block and the radius would work because the block and area needed to be claimed would be stationary if that's a possibility
     
  14. Offline

    spazymcgee

    I posted some more information on the conversation, i will be going ahead and working on the option of issuing either a location(of the block) or a player

    ok the plugin is now updated again, there are now two options for /f blockclaim
    you can either do /f blockclaim @p <radius> <faction> to claim a chunk for a faction when a player pushes the button in a radius, possibly inputting a faction to substitute for the one the player is in.

    or you can do /f blockclaim <x pos of the block> <z pos of the block> <radius> <faction> to claim an area in a radius around the block for a specific faction.

    note that because factions uses chunks, the position inputted for the block can be off, so long as it remains in the same chunk, but the position must be the actual coordinates (not the chunk coordinates). for the same reason, the y coordinate is not necessary.

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

Share This Page