Spawn Protection

Discussion in 'Plugin Development' started by ajs333, Nov 2, 2013.

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

    ajs333

    Can someone please help me create a spawn protection like McPvP. I would like for it to be so that when a player walks over a block (GlowStone) they lose spawn protection. In spawn I want it so that you can't take any damage.
     
  2. Offline

    ajs333

    The Gaming Grunts
    I have been using WorldGuard for a long time but I now want to make a custom one!! :D
     
  3. Offline

    kevinspl2000

    If you want to download one, check out jProtection on bukkit.org
    And if you want to create it yourself it is about 1 hour of work if you know all the code. I made one myself took me about 2 hours since I was still a noob lool..
     
  4. Offline

    ajs333

  5. Offline

    kevinspl2000

    ajs333
    Anyway this is what you have to do:
    Make a main class where you register all events with a variable
    Make a listener class with an arraylist of players who have spawn protection
    If a player is in the arraylist then have invincibility
    If a player retypes /spawn or whatever they gain spawn protection
    Make a config to store the location of spawn
    Then add the loose spawn protection messages or whatever you would want. Implementing worldguard would be pretty hard but that might only be for me since ive never done nothing with worldguard or worledit :)
     
  6. Offline

    ajs333

    kevinspl2000
    I'm pretty new to coding but I have been working with plugins for more than 2 years...
     
  7. Offline

    xTrollxDudex

    I think that's contradictory, just saying.
     
  8. ajs333
    Basically what you need to check for is the various block place & destroy and player & entity damage events and then cancel them :p
     
  9. Offline

    ajs333

  10. Offline

    HyrulesLegend

  11. ajs333
    Use the PlayerMoveEvent and get the player's location. Then check the block directly below the player using

    Code:java
    1. Location loc = event.getPlayer().getLocation();


    and then

    Code:java
    1. if (loc.getBlockX().getType().equals(something)){
    2. //do some stuff
    3. }
     
  12. Offline

    ajs333

    The Gaming Grunts
    Thanks! Lets start coding!! (By that I mean... I'm going to start coding)
     
    The Gaming Grunts likes this.
  13. Offline

    TheUpdater

    PHP:
            Block b p.getLocation().getBlock();
            
    Block b1 b.getRelative(BlockFace.DOWN);
    if (
    b1.getType() == Material.GLOWSTONE) {
    make your stuff
     
  14. Offline

    MayoDwarf

    Why do it if they walk over a glowstone? Why not an area?
     
  15. Because that's what ajs333 was looking for :p
     
  16. Offline

    ajs333

  17. Offline

    MayoDwarf

    Hmm ok just seems kinda weird cause if a regular player gets it they could abuse it.
     
Thread Status:
Not open for further replies.

Share This Page