Initial commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package net.crankedpvp.voyages.rooms;
|
||||
|
||||
import net.crankedpvp.voyages.struct.annotations.ConfigValue;
|
||||
import net.crankedpvp.voyages.struct.player.VoyagePlayer;
|
||||
import net.crankedpvp.voyages.struct.room.Room;
|
||||
import net.crankedpvp.voyages.struct.room.RoomOptions;
|
||||
import net.crankedpvp.voyages.struct.room.VoyageRoom;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class MazeRoom extends VoyageRoom<VoyagePlayer> {
|
||||
|
||||
@ConfigValue
|
||||
private List<Location> spawnPoints = Collections.singletonList(new Location(Bukkit.getWorld("world_voyage"), 16, 5, -36));
|
||||
|
||||
public MazeRoom(final Location spawnLocation) {
|
||||
super(spawnLocation, "Maze", Room.MAZE, 300, RoomOptions.builder().build(), "Get to the end of the maze");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startVoyageRoom() {
|
||||
Location spawnPointLocation = this.spawnPoints.get(new Random().nextInt(spawnPoints.size()));
|
||||
super.teleportParticipantsTo(spawnPointLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopVoyageRoom() {
|
||||
super.nextRoom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addParticipant(Player player) {
|
||||
super.addParticipant(new VoyagePlayer(player));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void checkPressurePlate(PlayerInteractEvent event) {
|
||||
if(!this.isParticipant(event.getPlayer())) return;
|
||||
if(event.getPlayer() == null) return;
|
||||
if(event.getAction() != Action.PHYSICAL) return;
|
||||
if(!event.getClickedBlock().getType().equals(Material.GOLD_PLATE)) return;
|
||||
this.stopVoyageRoom();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user