We want to start our dungeon with a pressure plate instead of calling a function. This way we won't need to OP players who are trying our dungeon.
Place a stone pressure plate somewhere in the main room to start the dungeon. Here it is on the edge of the well, because who could resist the temptation to try to see how deep it is?
There are several different types of player interact actions, and you can find the complete list of them here on the Bukkit API. Use the code below to figure out what type of action stepping on a pressure plate is considered to be.
if statement to check only for the action type of a pressure plate step, and use a broadcast message to make sure that it is working.
Save, deploy, and reload on your server and step on a pressure plate. Try left and right clicking blocks and the air to make sure that only the pressure plate gives you the message.
Before, we made
startDungeon() an export function, so that we could call it in the command line of Minecraft. Because it was an export function, we could use the keyword
self to refer to whoever typed it in the console.
We need to change this function so that it takes an input (also called a parameter), so it knows what player to make
Make a function called
dungeonRoomsFinished. It should:
forloop to go through all the rooms in the
return truesince return would have ended it early.
Make a new Boolean (true/false) variable called
roomsFinished that starts out false.
Too keep the code from going over and over again like the broadcast message, we need to have this code run only if the rooms aren't already finished, and set it to true so that the code only happens once.
Inside of the
- teleport the player to the dungeon entrance again
- create a new drone at
fountainLoc and have it place a water block there.