~~Astral Projection~~

Astral Mode is a way to explore the world safely from your home! Players lay down in a bed and issue /astral to activate Astral Mode. After a set time, ie 30 seconds, the player will leave their body! While players are in Astral Mode they look like a ghost, may fly, activate buttons, levers, doors. While in Astral Mode players may not place blocks, attack players, pick items, use inventory.

If players are attacked in astral mode they are pulled back into their bodies.

Requested Features:

Configurable time to enter Astral Mode.
Configurable time that Astral Mode lasts in seconds.
Configurable cooldown time to use Astral Mode.
Configurable time of day it may be used.
Command to enter and leave Astral Mode.
Permission system PEX

There is no way to make an NPC stay in a bed to allow them to go flowing elsewhere and leave a version behind. I can make the /astral to make them fly, but there is not a way to cancel it by having them hit in bed while flying.

There is no way to make an NPC stay in a bed to allow them to go flowing elsewhere and leave a version behind. I can make the /astral to make them fly, but there is not a way to cancel it by having them hit in bed while flying.

Click to expand...

Get the interactevent, check if its a bed that has been clicked, get the location and
for (Player p : Bukkit.getOnlinePlayers()){
if (player.getBedSpawnLocation() == loc ){//of the bed
player.teleport(loc);
player.setFlying(false);
player.setAllowedFlight(false);
}

}
And maybe add some checks to see if they are in astral mode (check if they fly, etc)

Get the interactevent, check if its a bed that has been clicked, get the location and
for (Player p : Bukkit.getOnlinePlayers()){
if (player.getBedSpawnLocation() == loc ){//of the bed
player.teleport(loc);
player.setFlying(false);
player.setAllowedFlight(false);
}

}
And maybe add some checks to see if they are in astral mode (check if they fly, etc)

Should work...

Click to expand...

Well that would be fine, I could do it like that but it sounded like he wanted to have an actual NPC in the bed