Elevator Button Plugin

U

/u/livelyeko

Guest
Member
Hey, I just recently picked up plugins and am trying to create a button that will teleport players upwards or downwards. It's basically an elevator button and I wanted to add custom data or some form of identification for the button, like "elev_button". That way, the code won't activate when someone pushes a random button other than the ones assigned as elevator buttons.

I don't know how to do that because if you name a block something and then place it down, the edited data is lost. Anyone got pointers?



Here's a snippet of my code and sorry in advance if this is spaghetti:

public void onPlayerInteract(PlayerInteractEvent event) {

if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {

if ((event.getClickedBlock() != null) && (event.getAction() == Action.RIGHT_CLICK_BLOCK)) {

if (event.getClickedBlock().hasMetadata("elev_button")) {

Player player = event.getPlayer();

Location playerloc = player.getLocation();

Location newloc = playerloc.add(0, 7, 0);player.teleport(newloc);

player.sendMessage(ChatColor.GREEN+"Next Floor");

player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 2, 1);

}}}}}

submitted by /u/livelyeko
[link] [comments]

Continue reading...

free plugins
minecraft paid for free
spigotmc
SpigotMC
free minecraft paid plugins
free minecraft plugins
aac free
ewg free
Minecraft Premium Plugins
ewg free download
litebans free
epicworldgenerator free
free schematics
leaked schematics minecraft
schematics
schematics leaked
schematics free
minecraft schematics free
paid minecraft schematics free
paid minecraft schematics for free
free cracked plugins
free cracked minecraft plugins
plugins
featherboard download
featherboard plugin download
antiaura download
minecraft plugins
xenforo leaked
xenforo for free
xenforo addons
 
BlackSpigot General Chat
Rules Help Users
    WASTEDYEARS @ WASTEDYEARS: nobody can get that pack
    Top