Skip to content

Commit

Permalink
Merge pull request #123 from KevinDaGame/develop
Browse files Browse the repository at this point in the history
Version 8.5.0
  • Loading branch information
KevinDaGame authored Mar 17, 2023
2 parents da8b7ea + b957d59 commit a04c736
Show file tree
Hide file tree
Showing 135 changed files with 1,562 additions and 2,287 deletions.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,18 @@ import com.github.kevindagame.voxelsniper.events.player.PlayerSnipeEvent
import com.github.kevindagame.voxelsniper.material.VoxelMaterial
import com.github.kevindagame.voxelsniper.world.IWorld
import com.google.common.collect.ImmutableList
import java.util.*


/**
* Abstract implementation of the [IBrush] interface.
*/
abstract class AbstractBrush : IBrush {
/**
* @return the targetBlock
*/
/**
* @param targetBlock the targetBlock to set
*/

/**
* Targeted Block.
*/
protected lateinit var targetBlock: IBlock
/**
* @return Block before target Block.
*/
/**
* @param lastBlock Last Block before target Block.
*/
lateinit var targetBlock: IBlock

/**
* Last Block before targeted Block.
*/
Expand All @@ -51,7 +41,8 @@ abstract class AbstractBrush : IBrush {
/**
* Brush name.
*/
private var name = "Undefined"
override var name by initOnce<String>()
override var permissionNode: String by initOnce()
protected var snipeAction: SnipeAction? = null

private fun preparePerform(v: SnipeData, clickedBlock: IBlock, clickedFace: BlockFace): Boolean {
Expand Down Expand Up @@ -150,14 +141,14 @@ abstract class AbstractBrush : IBrush {
*
* @param v Sniper caller
*/
protected open fun arrow(v: SnipeData?) {}
protected open fun arrow(v: SnipeData) {}

/**
* The powder action. Executed when a player RightClicks with Gunpowder
*
* @param v Sniper caller
*/
protected open fun powder(v: SnipeData?) {}
protected open fun powder(v: SnipeData) {}
abstract override fun info(vm: VoxelMessage)
override fun parseParameters(triggerHandle: String, params: Array<String>, v: SnipeData) {
v.sendMessage(Messages.BRUSH_NO_PARAMS_ACCEPTED)
Expand All @@ -182,7 +173,10 @@ abstract class AbstractBrush : IBrush {
* @return boolean
*/
protected fun getTarget(v: SnipeData, clickedBlock: IBlock?, clickedFace: BlockFace?): Boolean {
return if (clickedBlock != null) {
val targetBlock: IBlock?
val lastBlock: IBlock?

if (clickedBlock != null) {
targetBlock = clickedBlock
lastBlock = clickedBlock.getRelative(clickedFace)
if (lastBlock == null) {
Expand All @@ -192,7 +186,6 @@ abstract class AbstractBrush : IBrush {
if (v.owner().getSnipeData(v.owner().currentToolId).isLightningEnabled) {
world.strikeLightning(targetBlock.location)
}
true
} else {
val rangeBlockHelper: BlockHelper
if (v.owner().getSnipeData(v.owner().currentToolId).isRanged) {
Expand All @@ -203,7 +196,7 @@ abstract class AbstractBrush : IBrush {
targetBlock = rangeBlockHelper.rangeBlock
} else {
rangeBlockHelper = BlockHelper(v.owner().player)
targetBlock = rangeBlockHelper.targetBlock
targetBlock = rangeBlockHelper.targetBlock!!
}
if (targetBlock != null) {
lastBlock = rangeBlockHelper.lastBlock
Expand All @@ -214,38 +207,25 @@ abstract class AbstractBrush : IBrush {
if (v.owner().getSnipeData(v.owner().currentToolId).isLightningEnabled) {
world.strikeLightning(targetBlock.location)
}
true
} else {
v.sendMessage(Messages.TARGET_MUST_BE_VISIBLE)
false
return false
}
}
}

override fun getName(): String {
return name
}

override fun setName(name: String) {
this.name = name
}

override fun getBrushCategory(): String {
return "General"
this.lastBlock = lastBlock
this.targetBlock = targetBlock
return true
}

/**
* @return the world
*/
protected val world: IWorld
protected get() = targetBlock.world
protected val minHeight: Int
protected get() = world.minWorldHeight
protected val maxHeight: Int
protected get() = world.maxWorldHeight
protected val world: IWorld get() = targetBlock.world
protected val minHeight: Int get() = world.minWorldHeight
protected val maxHeight: Int get() = world.maxWorldHeight

protected fun isInWorldHeight(height: Int): Boolean {
return minHeight <= height && maxHeight > height
return world.isInWorldHeight(height)
}

/**
Expand All @@ -256,7 +236,7 @@ abstract class AbstractBrush : IBrush {
* @param z Z coordinate
* @return Type ID of Block at given coordinates in the world of the targeted Block.
*/
protected fun getBlockMaterialAt(x: Int, y: Int, z: Int): VoxelMaterial {
fun getBlockMaterialAt(x: Int, y: Int, z: Int): VoxelMaterial {
return if (isInWorldHeight(y)) world.getBlock(x, y, z).material else VoxelMaterial.AIR
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ public class BiomeBrush extends AbstractBrush {

private VoxelBiome selectedBiome = VoxelBiome.PLAINS;

public BiomeBrush() {
this.setName("Biome");
}


private void biome(final SnipeData v) {
final int brushSize = v.getBrushSize();
Expand Down Expand Up @@ -77,9 +75,4 @@ public List<String> registerArguments() {

return VoxelBiome.BIOMES.values().stream().map(VoxelBiome::getKey).collect(Collectors.toList());
}

@Override
public String getPermissionNode() {
return "voxelsniper.brush.biome";
}
}
Loading

0 comments on commit a04c736

Please sign in to comment.