use of org.bukkit.block.Block in project Prism-Bukkit by prism.
the class ProfileWand method showLocationProfile.
/**
*
* @param player
* @param block
* @param loc
*/
protected void showLocationProfile(Player player, Location loc) {
final Block block = loc.getBlock();
player.sendMessage(Prism.messenger.playerHeaderMsg("Location Profile"));
player.sendMessage(Prism.messenger.playerMsg("Name: " + block.getType().toString().toLowerCase()));
player.sendMessage(Prism.messenger.playerMsg("Alias: " + Prism.getItems().getAlias(block.getTypeId(), block.getData())));
player.sendMessage(Prism.messenger.playerMsg("ID: " + block.getTypeId() + ":" + block.getData()));
player.sendMessage(Prism.messenger.playerMsg("Coords: " + block.getX() + " " + block.getY() + " " + block.getZ()));
}
use of org.bukkit.block.Block in project Prism-Bukkit by prism.
the class RollbackWand method rollback.
/**
*
* @param player
* @param block
*/
protected void rollback(Player player, Location loc) {
final Block block = loc.getBlock();
plugin.eventTimer.recordTimedEvent("rollback wand used");
// Build params
QueryParameters params;
try {
params = parameters.clone();
} catch (final CloneNotSupportedException ex) {
params = new QueryParameters();
player.sendMessage(Prism.messenger.playerError("Error retrieving parameters. Checking with default parameters."));
}
params.setWorld(player.getWorld().getName());
params.setSpecificBlockLocation(block.getLocation());
params.setLimit(1);
params.setProcessType(PrismProcessType.ROLLBACK);
boolean timeDefault = false;
for (final String _default : params.getDefaultsUsed()) {
if (_default.startsWith("t:")) {
timeDefault = true;
}
}
if (timeDefault) {
params.setIgnoreTime(true);
}
final ActionsQuery aq = new ActionsQuery(plugin);
final QueryResult results = aq.lookup(params, player);
if (!results.getActionResults().isEmpty()) {
final Rollback rb = new Rollback(plugin, player, results.getActionResults(), params, new PrismApplierCallback());
rb.apply();
} else {
final String space_name = (block.getType().equals(Material.AIR) ? "space" : block.getType().toString().replaceAll("_", " ").toLowerCase() + (block.getType().toString().endsWith("BLOCK") ? "" : " block"));
player.sendMessage(Prism.messenger.playerError("Nothing to rollback for this " + space_name + " found."));
}
}
use of org.bukkit.block.Block in project Prism-Bukkit by prism.
the class PrismBlockEvents method onPistonRetract.
/**
*
* @param event
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPistonRetract(final BlockPistonRetractEvent event) {
if (!Prism.getIgnore().event("block-shift", event.getBlock()))
return;
if (!event.isSticky())
return;
final Block block = event.getBlock();
if (block.getType().equals(Material.AIR))
return;
RecordingQueue.addToQueue(ActionFactory.createBlockShift("block-shift", event.getRetractLocation().getBlock(), block.getRelative(event.getDirection()).getLocation(), "Piston"));
}
use of org.bukkit.block.Block in project Prism-Bukkit by prism.
the class PrismBlockEvents method onBlockBreak.
/**
*
* @param event
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(final BlockBreakEvent event) {
final Player player = event.getPlayer();
Block block = event.getBlock();
if (block.getType().equals(Material.AIR))
return;
// Run ore find alerts
if (!player.hasPermission("prism.alerts.ores.ignore") && !player.hasPermission("prism.alerts.ignore")) {
plugin.oreMonitor.processAlertsFromBlock(player, block);
}
if (!Prism.getIgnore().event("block-break", player))
return;
// Change handling a bit if it's a long block
final Block sibling = me.botsko.elixr.BlockUtils.getSiblingForDoubleLengthBlock(block);
if (sibling != null && !block.getType().equals(Material.CHEST) && !block.getType().equals(Material.TRAPPED_CHEST)) {
block = sibling;
}
// log items removed from container
// note: done before the container so a "rewind" for rollback will work
// properly
logItemRemoveFromDestroyedContainer(player.getName(), block);
RecordingQueue.addToQueue(ActionFactory.createBlock("block-break", block, player.getName()));
// check for block relationships
logBlockRelationshipsForBlock(player.getName(), block);
// if obsidian, log portal blocks
if (block.getType().equals(Material.OBSIDIAN)) {
final ArrayList<Block> blocks = me.botsko.elixr.BlockUtils.findConnectedBlocksOfType(Material.PORTAL, block, null);
if (!blocks.isEmpty()) {
// Only log 1 portal break, we don't need all 8
RecordingQueue.addToQueue(ActionFactory.createBlock("block-break", blocks.get(0), player.getName()));
}
}
// Pass to the break alerter
if (!player.hasPermission("prism.alerts.use.break.ignore") && !player.hasPermission("prism.alerts.ignore")) {
plugin.useMonitor.alertOnBlockBreak(player, event.getBlock());
}
}
use of org.bukkit.block.Block in project Prism-Bukkit by prism.
the class PrismBlockEvents method onBlockBurn.
/**
*
* @param event
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBurn(final BlockBurnEvent event) {
if (!Prism.getIgnore().event("block-burn", event.getBlock()))
return;
Block block = event.getBlock();
RecordingQueue.addToQueue(ActionFactory.createBlock("block-burn", block, "Environment"));
// Change handling a bit if it's a long block
final Block sibling = me.botsko.elixr.BlockUtils.getSiblingForDoubleLengthBlock(block);
if (sibling != null && !block.getType().equals(Material.CHEST) && !block.getType().equals(Material.TRAPPED_CHEST)) {
block = sibling;
}
// check for block relationships
logBlockRelationshipsForBlock("Environment", block);
}
Aggregations