Random Spawn Plugin

Discussion in 'Plugin Requests' started by Lightcaster5, Jul 11, 2019 at 6:05 AM.

  1. Offline

    Lightcaster5

    Name: RandomSpawn
    Version: 1.12.2
    Description: Randomly teleports players on first join/death to a random location IN set values. Players won't be teleported underground or in a cave. If anyone has played 2b2t before it is something like that. Along with the random spawn there should be a way to list blocks that players cannot spawn on/in.
    Example of the config:
    Code:
    #Players will be teleported randomly between values
    pos1: -100
    pos2: 100
    
    #Disallowed blocks
    enable-blacklist: 'true'
    blacklisted-blocks:
      - lava
      - water
      - cactus
      - diamond_block
    
    no-permission: '&cYou do not have permission to use this command!'
    Commands:
    /rtppos1 (sets the first position, this shouldn't use y-values)
    /rtppos2 (sets the second position, this shouldn't use y-values)

    Permissions:
    rtp.setpos (allows players to use the /rtppos1 & /rtppos2)
     
  2. Offline

    IncinerateZ

    This should cover what you're looking for.

    Teleports new players to your server to the specified coordinates, to the surface, and avoiding banned blocks.

    I'm quite new to dealing with configs so I made a separate readme textfile for specifications and descriptions.

    Commands: /rtp pos1, /rtp pos2
    Permissions: rtp.setpos

    Tell me if you need anything changed.
     
  3. Offline

    Lightcaster5

    Haven't tried it yet but I will when FileZilla loads. You said "new" players? This was meant to be new and onDeath... if it isn't I will let you know if I need more help because I know a little about java and the spigot api and might be able to modify your code or add a new class that does the same thing as the onPlayerJoin event.

    Edit:
    I just decompiled the code and saw that there was no onPlayerDeath event so I am just going to copy everything into intellij and copy the onPlayerJoin event and just change it to a death event. I will let you know if everything works after that. Thanks!

    Edit:
    Alright so everything kinda works... There is a problem where a player spawns on a block with no lava but there is lava right above the block so the player still dies.
     
    Last edited: Jul 15, 2019 at 7:24 AM
  4. Online

    KarimAKL

    @Lightcaster5 If you know about Java and the Bukkit/Spigot API, then why aren't you creating the plugin yourself? (I'm just curious) If you have any questions you could always ask in the Plugin Development forum.
     
  5. Offline

    Lightcaster5

    I said "I know a little about java and the spigot api" so stuff like making a simple help command with a few pages using arguments or making custom death messages. I asked for a plugin like this because it was far beyond what I knew and I already attempted creating the plugin myself more than three times so I thought it would be best to simply build off of someone elses code.
     
  6. Online

    KarimAKL

    @Lightcaster5 I see. :7 When you say "lava right above the block", where do you mean? Would you like lava blocked only for the blocks the player is inside or also if lava is going to flow down onto the player? In case you also want possible flowing lava to be blocked, do you only want lava in the same X and Z or also lava that's going to flow down a path onto the player? I'm just asking so that @IncinerateZ doesn't have to. (in case they fix this for you)
     
  7. Offline

    Lightcaster5

    The problem is, now that you said it... the player still can spawn in flowing lava but I thought it was because there was air under the lava... What you pointed out is correct and flowing lava and flowing water need to be blocked too.

    Edit:
    This may be a me error... let me see what happens if I add the flowing variants to the blacklisted blocks list.

    Edit:
    It was a me error... Everything worked after I added the flowing variants to the blacklisted blocks list. Thanks @KarimAKL and @IncinerateZ for your help.

    Yet another... Edit:
    New problem... A player can still spawn on a block, lets say cobblestone, with air right above it but there is lava above the air. Example:
    Layer 3 - Lava (The plugin doesn't pick this up and the player still spawns in it)
    Layer 2 - Air (This means a player can spawn on the dirt below)
    Layer 1 - Dirt

    Please help.
     
    Last edited: Jul 15, 2019 at 8:45 AM
  8. Offline

    IncinerateZ

    No problem, didn't quite get the on join part you requested due to wording stuff so I left it out :)

    Edit: Updated the plugin: download.
    Changes: -Added an onPlayerRespawn (This is better, but if you really want an onPlayerDeath, i'll change it for you)
    -Tweaked Config: Used STATIONARY_WATER and WATER.
    -Updated pos1 & pos2 subcommand to auto reload config.

    After these changes I tried replicating your bug but I couldn't get it to trigger, I guess it got fixed with the config tweaks?

    Lemme know if more problems arise (which shouldn't), or if you want it to be onPlayerDeath.

    Edit2: forgot to undo stuff i used for debugging; updated download link
     
    Last edited: Jul 15, 2019 at 10:57 PM
  9. Online

    KarimAKL

    A player is 2 blocks high; do you mean that their feet's block is air and their head's block is lava? Either way, answering my question from before should explain what you want.
     
  10. Offline

    Lightcaster5

    Feet block air, head block lava... And the command doesnt work at all... and for some reason the config isnt working to set the positions. The command gives no output but doesnt say "Unknown command. Type "/help" for help."

    I dont really understand your question all too well but all I need is for the player to not spawn in lava or flowing lava... in anyway that could kill them upon respawn or join.

    Now I have to get some sleep but I will be able to reply more tomorrow. Thanks for the help and all future help.
     
  11. Online

    KarimAKL

    @Lightcaster5 I've made a little example in Windows Paint. :p (Took forever with my little knowledge of that app. xD)
    Example.png
    Imagine the grey as stone (in a cave), the blue as a player and the red as a lava source block. That lava is gonna flow from there onto the player, i was asking if you wanted to check for lava that's gonna do something like that, or you just want to check the player's feet and head.
     
  12. Offline

    Lightcaster5

    I wanted it to check if the lava will or has already fallen to where the player is going to be randomly teleported to.

    Thanks and yes, adding a onPlayerDeath would be nice. I havent tested everything just yet because I cant get on my main pc but I will later and when I do I will be sure to let you know. Thanks!
     
    Last edited by a moderator: Jul 16, 2019 at 10:35 AM
  13. Online

    KarimAKL

    "will", does that include what i was trying to explain?
     
  14. Offline

    Lightcaster5

    yes, and I meant if the lava will fall on the player or has already fallen to the spot.
     

Share This Page