TPBooks or Teleport Scrolls

Discussion in 'Plugin Requests' started by sebdomsan54, Oct 29, 2016.

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

    sebdomsan54

    Plugin category: Mechanics

    Minecraft version: Preferable the newest (1.8 to 1.11)

    Suggested name: TPBooks or warp books(something like this )

    What I want:
    Most teleportation plugins are ether admin controlled or private warps.
    What Im suggesting is a plugin that lets players craft books/scrolls(an item) that can teleport then to any location that a player wants
    for Example if i craft a Teleport scroll and use it(right click) from now on if i use that book it will warp me back to the location i first used it. i was hoping this can be done at a cost(enderpearls or some other item) and a warm up or cool down from a config
    I think the cords and the info about the book should be stored in the lore or inside the book so that the player can still rename the book and even trade and sell it

    also i was thinking about like warp pads like an physical thing that if a player steps on the pressure plate it warps them. I was thinking that they could be like a gold pressure plate on top of and emerald block ontop of a hopper(dropper or furnace any storage block really ) that has the Teleport item inside it and mabey even the item that i the cost of the teleport

    another thing could be item frames that have the teleport item inside of them so that when the player right clicks it. its like the used to book

    if you would like to see the above i have this in a sort of working state i have it working in command helper just pm me

    i would also like to see the warp pads able to warp mobs

    maybe even like warp splash potions (for pvp kinda overpowerd)

    Thing that should be in the books lore/info
    Cost:
    Warmup:
    Cooldown:
    Target:

    Ideas for commands: None that I can think off

    Ideas for permissions:
    Transportsscrolls.craft allows the player to make the teleport item
    Transportsscrolls.create allows the player to set the destination
    Transportsscrolls.use allows the player to teleport to the destentation
    Transportsscrolls.telepad.use allowes the player to use the warp pads
    Transportsscrolls.frame.use allowes the player to use the warp frames

    When I'd like it by: When ever just an idea
     
  2. Offline

    I Al Istannen

    @sebdomsan54
    • How is the cost decided?
    • How is the warmup decided?
    • How is the cooldown decided?
    The pressure plate one:
    • Does it consume the item?
    • Does it cost the normal cost for the player using it?
    • What do mobs need to pay?
    Same for the item frame

    Splash Potion
    • What does it cost?
    • How do you obtain it?
    • What potion is it?
    • Does it work for all affected entities? If yes, who pays?

    Just some questions that popped into my head when skimming your post.
     
  3. Offline

    sebdomsan54

    Good questions

    • I guess the price would be static from a config
    • Same with warm up and cool down but if necessary able to be changed per book for expansion and rpg purposes

    It now dawns on me that if done in the lore it will make it alot easier for server devs to make the books by there own means

    About the pressure plate
    • Yes it still has a cost
    • Yes should cost the same
    • Yes mobs should pay
    • The cost should come from the player of the ive the book is in

    For item frams
    • basically like the player used it from there inv

    About the splash potion
    This idea is really half baked and can be void
    • I guess like 3 time per player warped so if 3 people get warped the cost it 9 (agian probably a config)
    • No clue on how to obtain it
    • And the most useless potion that we can think of
    • Yes should affect all entitys
    • And the player who tossed it
     
  4. Offline

    Wispyy

    I might try this, it will probably be a while though so don't expect it pretty fast. You said newest, so do you want 1.10 or 1.8 through 1.11 as said in the ()?
    Edit: How would the mobs pay...? Health? Weakness?
     
    Last edited: Nov 1, 2016
  5. Offline

    sebdomsan54

    Thats fine take your time the mobs would pay by the enderpearls(or items) that are in the hopper along side the book
    And the newer the beter for the mc version
     
  6. Offline

    Wispyy

    Okay. Working on it in 1.10.

    Edit: In the permissions you said: >
    Transportsscrolls.craft allows the player to make the teleport item
    Transportsscrolls.create allows the player to set the destination

    As in making the item, if you don't have this permission and you craft a book/potion/put it in a sign it will prevent you from doing so? Because I interpreted the create as making the books information but then is the crafting the book/potion/item frame itself? And if so, would this cause a conflict if someone tried to make a normal book? I'll set it up nonetheless, but if it's different than that please tell me.

    E: Permissions are default to everyone, op, or no one?
     
    Last edited: Nov 1, 2016
  7. Offline

    sebdomsan54

    All of these should be default to everyone
    And the Transportsscrolls.craft should just be for crafting the book

    I think having a Separate perm for both the potions making the crafting and the putting in the item frame will make the plugin more versatile and will draw more attention to your plugin

    also this just came to mind but i think the cost should be default to one in the config but also be a per book so there can be free admin warps or expensive private warps
     
    Last edited: Nov 2, 2016
  8. Offline

    Wispyy

    I'm sort of trapped into this web of confusion but hopefully if you expand upon this I can understand better.
    • You want a plugin that lets people make a book with coordinates and a price inside it (amount of the item defined in the config might be an idea, and what the item is) and when someone uses that book it takes that set item and teleports them.
    • There is also a pressure plate that below it has an emerald block (any block defined in config if you want?) and a hopper with its contents the book. You step on the plate and it takes a(n) {item} and tps you. I need more clarification, does it take {item} from the player or the hopper?
    • Splash Potions (This was actually a really cool idea), if you throw it on the ground it tps those in the splash radius (config defined radius or does it just tp the thrower?). However, how do you set the price and the coordinates? I was thinking maybe see if I could make a potion with an enderpearl and the price and coordinates are defined by when left clicking the splash on the ground and having the enderpearls in your inventory.
    • If you click a book in a frame and you have the permission to use the teleport it will tp you?
    • Permissions.
    • >> Transportscrolls.craft is the permission to make the book containing the Coordinates and price.
    • >> Transportscrolls.create does..?
    • >> Transportscrolls.use I understand. Same with .telepad.use and .frame.use.
    • So if the above is true, transportscrolls.create allows you to make the potion and put it in frames because books are under craft because it's to make the coordinates and price as I said (guessed) above.
    Sorry for all the naïve questions, but I just want to make sure I get this right before I dive head on in it and then have to make big changes later.
     
  9. Offline

    sebdomsan54

    1)yes thats 100% correct

    2)the hopper and if the hopper dosent have then the player

    3)any players in the radius should be warped and the person who threw it should be charged for everyone and yhea i think that would work

    4)yes if you have the perm to teleport it will teleport you

    5)this will prevent the crafting of the book
    6)this will let the player set the cords of the book

    7)yes thats correct

    And feel free to ask as many questions its really nice to see someone who likes this idea so much
     
  10. Offline

    Wispyy

    Okay, that's clearer. If there isn't a book in the hopper and a mob walks on the telepad it won't do anything I assume. I disabled crafting for a book & quill as that's what you need to write. You can still make books however.
     
  11. Offline

    sebdomsan54

    Yes if theresno book it should do nothing

    Hmm i dont wana disable books
    Can we just put characters that a normal keyboard cant type as identification that thats a warp book like alt codes
     
  12. Offline

    Wispyy

    Then how would people make the book itself?
     
  13. Offline

    I Al Istannen

    @sebdomsan54 @Wispyy
    NBT-Tags. I made a "small" Utility class to make dealing with them acceptable. Here.

    Or you encode an ID in the lore using Color codes. The color codes are hexadecimal digits prefixed by the color char, so you can encode 4 bits in one colour code.

    This requires a lot more effort than using the NBT tags though (map for key -> data).
    If Spigot or another fork would have implemented a nice NBT library, this wouldn't even be a question.


    You could create them with a command or crafting recipe then. This will give them an Item with a Boolean in the NBT tags set to true. This means, this book may be bound to a location.
    Then, upon binding, just store the location in the NBT (a string for the world, 3 doubles for coordinates and 2 floats for yaw and pitch) and retrieve that upon initiating a teleport.
     
  14. Offline

    sebdomsan54

    @Wispyy @I Al Istannen
    This is my current recipe
    recipe.PNG

    This is what happens atm after using the book (was a major prototype when i did this)
    book used.PNG

    This is the method script that i made for this but it is way out of date and bugs out all the time
    PHP:
    #Add recipe
    add_recipe(
        array(
            
    type'SHAPED',
            
    result: array(type340qty1meta: array(lore:Blank Teleport Scroll)),
            
    shape: array(
                
    'ASA',
                
    'EBR',
                
    'AFA'
            
    ),
            
    ingredients: array('A'0,'S'280,'E'368,'B'340,'R'331,'F':288)
        )
    )
    #End recipe

    #item frame stuff
    bind('player_interact_entity'nullnull, @c,null
        
    if (@c[clicked] == ITEM_FRAME){
            if (
    pinfo(player(), 11) == true){
             try(
             @
    fid = @c[id]
             @
    iif entity_spec(@fid)
             @
    lore = @iif[item][meta][lore]
             @
    lineOne array_get(@lore0)
             )
                if (@
    lineOne == 'Teleport Scroll'){
                 
    cancel()
                 @
    array_get(array_get(split(' Y:'array_get(split('X:'array_get(@lore1)), 10)), 00))
                 @
    array_get(array_get(split(' Z:'array_get(split('Y:'array_get(@lore1)), 10)), 00))
                 @
    array_get(array_get(split(' World:'array_get(split('Z:'array_get(@lore1)), 10)), 00))
                 @
    world array_get(array_get(split(' World:'array_get(@lore1)), 10))

                
                 
    assign(@loc, array(@x, @y, @z, @world))
                
                 
    assign(@loc, array(@x, @y, @z, @world))
                 @
    chunk get_chunk_loc(@loc)
                 
    load_chunk(@chunk[world], @chunk[x], @chunk[z])
                
                 
    set_ploc(@c[player], @loc)
                }
            }
        }
    )
    #End item frame stuff

    #telepads
    bind('pressure_plate_activated'nullnull, @cnull
        
    if((@c[activated] == true) && (get_block_at(array(@c[location][0], (@c[location][1]), @c[location][2], @c[location][3])) == '147:0') && (get_block_at(array(@c[location][0], (@c[location][1] - 1), @c[location][2], @c[location][3])) == '152:0') && (get_block_at(array(@c[location][0], (@c[location][1] - 2), @c[location][2], @c[location][3])) == '154:8')){
         @
    hinv = (get_inventory(array(@c[location][0], (@c[location][1] - 2), @c[location][2], @c[location][3])))
            if(@
    hinv[0] != null){
                try(
                 @
    tplore = @hinv[0][meta][lore]
                 @
    lineOne array_get(@tplore0)
                )
                if (@
    lineOne == 'Teleport Scroll'){
                 
    cancel()
                 @
    array_get(array_get(split(' Y:'array_get(split('X:'array_get(@tplore1)), 10)), 00))
                 @
    array_get(array_get(split(' Z:'array_get(split('Y:'array_get(@tplore1)), 10)), 00))
                 @
    array_get(array_get(split(' World:'array_get(split('Z:'array_get(@tplore1)), 10)), 00))
                 @
    world array_get(array_get(split(' World:'array_get(@tplore1)), 10))

                
                 
    assign(@loc, array(@x, @y, @z, @world))
                
                 
    assign(@loc, array(@x, @y, @z, @world))
                 @
    chunk get_chunk_loc(@loc)
                 
    load_chunk(@chunk[world], @chunk[x], @chunk[z])
                
                 
    set_ploc(@c[player], @loc)
                }
            }
        }
    )

    #End telepads

    #item Interactions
    bind('player_interact'null, array(item:340), @enull
    #book conditions
         
    if (@e[item] == '340:0'){    
             @
    meta get_itemmeta(null)
             if (
    is_null(@meta) || is_null(@meta['lore'])){
             exit()
             }
             @
    lineOne array_get(@meta[lore], 0)
    #Create scroll
             
    if (@lineOne == 'Blank Teleport Scroll'){
                 @
    string(array_get(ploc(player()), 0))
                 @
    string(array_get(ploc(player()), 1))
                 @
    string(array_get(ploc(player()), 2))
                 @
    world string(array_get(ploc(player()), 3))
                 @
    tele 'Teleport Scroll'
                 
    @locinfo concat("X:",@x," Y:",@y," Z:",@z," World:",@world)e
                 
    @meta2 get_itemmeta(player(), null);
                 if(
    is_null(@meta2)) {
                     @
    meta2 = array();
                 }
                 @
    meta2['lore'] = array(
                 @
    tele,
                 @
    locinfo,
                 );
                 
    set_itemmeta(player(), null, @meta2);
             }
    #teleport
             
    if (@lineOne == 'Teleport Scroll'){
                
                 @
    array_get(array_get(split(' Y:'array_get(split('X:', @meta['lore'][1]), 10)), 00))
                 @
    array_get(array_get(split(' Z:'array_get(split('Y:', @meta['lore'][1]), 10)), 00))
                 @
    array_get(array_get(split(' World:'array_get(split('Z:', @meta['lore'][1]), 10)), 00))
                 @
    world array_get(array_get(split(' World:', @meta['lore'][1]), 10))
                
                 
    assign(@loc, array(@x, @y, @z, @world))
                 @
    chunk get_chunk_loc(@loc)
                 
    load_chunk(@chunk[world], @chunk[x], @chunk[z])
                 
    set_ploc(@e[player], @loc)
                
             }
        }
    )
    #end item interactions
     
  15. Offline

    I Al Istannen

    @sebdomsan54
    I guess this is "Skript"? I have never worked with it and will not be able to help you.

    But the whole floating point number in the lore is a bit visually unpleasing. I have no idea what the limitations with Skript are, so I will not be able to really help you.
    But there may be a plugin for it to allow reading and writing NBT tags.
     
  16. Offline

    sebdomsan54

    Its command helper and its way out of date i cant code in java so thats what i used till the last update then everything broke so i put the idea up here so more people would see it
     
  17. Offline

    Wispyy

    That's actually pretty smart and useful, @I Al Istannen, thanks. I was thinking after you craft the book, if you left click & have the permission it sends the information at your current location? And then to add custom locations, you'd run a command(?) and give it XYZ. However, maybe add in what the location is in the lore so you're not falling into like a /teleportscrolls 1 -50 1 and then just die. I guess you would use the command for potions as well.

    However, I'm not quite familiar with Reflection. I added in a Lib of Reflection Utils that I added in as a class, but there still are a lot of errors in the util that you made. Stuff like the unknown methods. Such as:
    Code:
    private static Object asNMSCopy(ItemStack itemStack) {
    
    return ReflectionUtil.invokeMethod(CRAFT_ITEM_STACK_CLASS, null, "asNMSCopy",
    
    new Class[]{ItemStack.class}, itemStack);
    
    }
    
    Where .invokeMethod is telling me "
    Create method 'invokeMethod(Class<?>, Object, String, Class[], ItemStack)' in type 'ReflectionUtil'
    " as a quick fix.
    And I'm not sure what to do here :L
     
    Last edited: Nov 6, 2016
  18. Offline

    I Al Istannen

    @Wispyy
    You need this ReflectionUtil, have you downloaded and copied it?
    Make sure to import the correct one.
     
  19. Offline

    Wispyy

    That cleared it up, thank you :D
     
  20. Offline

    I Al Istannen

    @Wispyy
    I hope it works :)
    I found the storage method in NBT tags quite nice and easy to use. Though the Wrapper aren't the newest, they should work, as I used this exact same version in a plugin (MYST linking books) too.

    If you have any questions regarding anything, feel free to ask me!

    Have a nice evening/day (timezones ;))
     
  21. Offline

    sebdomsan54

    @Wispyy
    Hey sorry i know its kinda late in the game to be coming up with new ideas but what do you think of a the fallowing
    *these are all just ideas it is up to you if you want to go trough the trouble
    Idea #1
    preventing teleports(in/out)
    like if a sponge(any specified) block is with in 5 blocks
    or if you have some special item in your inv(no clue what this could be maybe sponge again lol or add an "enchant" to armor))

    Example #1:

    Say im in a trap and teleporting out would be cheap
    so if the player that set the trap put a sponge block with in 5 blocks of the trap it would keep me from warping out.

    Example #2:
    Say i had my teleport book on me and i was wandering around and i was killed by another player and they took my book now they can warp in when ever but if you manage to put a sponge block with in the warp location before the get around to using it your kinda safe and it gives you time to get you stuff and move

    Example #3:
    say im in a fight with another player and he has a warp potion on him set to a lava trap if he uses that i will die for sure so if i have an item on me to prevent that is more of a fair fight

    Idea #2
    adding durability to the books so that they break and the player has to make a new one just to make it less op
    *not sure how this would effect item frames and telepads (maybe just dont use durability for these or have a variant to the books)

    Question
    are you/can you make it so that if the player that is warping gets hit during warm up the tp cancels

    Ty again only ideas this is your plugin i just wana see this made this is something i have wanted for a while now



     
  22. Offline

    sebdomsan54

  23. Offline

    Aubameyang1

  24. Offline

    xelatercero

  25. Offline

    sebdomsan54

    @Aubameyang1 @xelatercero
    These both are really close to what i am looking for and i will end up using @Aubameyang1 version until a later point when i can find/gain access to something closer to what i am looking for thank you both great plugin to the both of you
     
  26. Offline

    Aubameyang1

    I'm glad I could help.
     
    Last edited by a moderator: Nov 23, 2016
Thread Status:
Not open for further replies.

Share This Page