public String first(String text) {
return text.substring(0, 1);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void blockPlace(BlockPlaceEvent bpe)
{
// Block placed by player
Block block = bpe.getBlock();
// Get the blocks material relative to the block placed by the player
Material main = block.getType();
Material up1 = block.getRelative(BlockFace.UP, 1).getType();
Material up2 = block.getRelative(BlockFace.UP, 2).getType();
Material down1 = block.getRelative(BlockFace.DOWN, 1).getType();
Material down2 = block.getRelative(BlockFace.DOWN, 2).getType();
// Concatenate the first letters of each of the materials
String materialFirstLetters = first(up1.toString()) + first(up2.toString()) +
first(main.toString()) + first(down1.toString()) +
first(down2.toString());
// Regex pattern
String regex = "DIJ..|I.DJ.|..IDJ";
// Check if the first letters of the materials match the regex pattern
if (materialFirstLetters.matches(regex))
{
System.out.println("Antenna Created");
}
}
Month: June 2012
Online Book Store
For my final year project I had to build an n-tier web application from scratch using design patterns such as MVC, Command, Factory, Service, and DAO and technologies such as Java, JSP, JSTL, Tomcat, JUnit, XML, HTML/CSS, Javascript, MySQL.
Homepage. Displays featured books, latest books, newest members, and recent reviews.
All Books. Displays list of books which can be sorted by Title, Price, Rating, or Release Date.
Book (top). Shows the books title, image, rating and
Book (bottom). Shows similar themed books. Reviews by the users which can be filtered.
Profile. Shows profile of user and their recent reviews.