From 8ff09d63919de98654619f9a2dd29fc4f753083e Mon Sep 17 00:00:00 2001 From: sk89q Date: Mon, 31 Mar 2014 20:36:17 -0700 Subject: [PATCH] Added AbstractLoggingExtent for block loggers. --- .../extent/AbstractLoggingExtent.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/main/java/com/sk89q/worldedit/extent/AbstractLoggingExtent.java diff --git a/src/main/java/com/sk89q/worldedit/extent/AbstractLoggingExtent.java b/src/main/java/com/sk89q/worldedit/extent/AbstractLoggingExtent.java new file mode 100644 index 000000000..b8b0dc398 --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/extent/AbstractLoggingExtent.java @@ -0,0 +1,49 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.blocks.BaseBlock; + +/** + * An abstract class to implement block loggers and so on with. + */ +public abstract class AbstractLoggingExtent extends ExtentDelegate { + + /** + * Create a new instance. + * + * @param extent the extent + */ + public AbstractLoggingExtent(Extent extent) { + super(extent); + } + + protected void onBlockSet(Vector position, BaseBlock newBlock) { + } + + @Override + public final boolean setBlock(Vector position, BaseBlock block) throws WorldEditException { + onBlockSet(position, block); + return super.setBlock(position, block); + } + +}