Skip to content

Commit

Permalink
Merge pull request #171 from KevinDaGame/develop
Browse files Browse the repository at this point in the history
Version 8.8.1
  • Loading branch information
KevinDaGame authored May 18, 2023
2 parents 555d0bb + bd563c0 commit 1aeaf0f
Show file tree
Hide file tree
Showing 58 changed files with 265 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import com.github.kevindagame.voxelsniper.blockdata.IBlockData
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.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap

/**
* Abstract implementation of the [IBrush] interface.
Expand Down Expand Up @@ -86,14 +87,14 @@ abstract class AbstractBrush : IBrush {
val event = PlayerSnipeEvent(
data.owner().player,
this,
ImmutableList.copyOf(operations),
Collections.unmodifiableList(operations),
operations.any { o -> o is CustomOperation }).callEvent()
if (!event.isCancelled) {
val undo = Undo()
var reloadArea = false
if (event.isCustom && this is CustomBrush) {
this.perform(event.operations.stream().filter { o -> !o.isCancelled && o is CustomOperation }
.map { o -> o as CustomOperation }.collect(ImmutableList.toImmutableList()), data, undo)
.map { o -> o as CustomOperation }.toList(), data, undo)
} else {
for (operation in event.operations) {
if (!operation.isCancelled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.github.kevindagame.brush.perform.PerformerBrush;
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.location.BaseLocation;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -255,7 +255,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("growth"));
arguments.addAll(Utils.newArrayList("growth"));

arguments.addAll(super.registerArguments());
return arguments;
Expand All @@ -267,7 +267,7 @@ public HashMap<String, List<String>> registerArgumentValues() {
HashMap<String, List<String>> argumentValues = new HashMap<>();


argumentValues.put("growth", Lists.newArrayList("[number]"));
argumentValues.put("growth", Utils.newArrayList("[number]"));

argumentValues.putAll(super.registerArgumentValues());
return argumentValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.github.kevindagame.util.Actions;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Shapes;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -70,7 +70,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("worldcoords"));
arguments.addAll(Utils.newArrayList("worldcoords"));

arguments.addAll(super.registerArguments());
return arguments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Shapes;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.util.brushOperation.BlockOperation;
import com.github.kevindagame.voxelsniper.block.BlockFace;
import com.github.kevindagame.voxelsniper.block.IBlock;
import com.github.kevindagame.voxelsniper.material.VoxelMaterial;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -71,6 +71,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str
@Override
public List<String> registerArguments() {

return new ArrayList<>(Lists.newArrayList("smooth"));
return new ArrayList<>(Utils.newArrayList("smooth"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.RotationAxis;
import com.github.kevindagame.util.Shapes;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.location.BaseLocation;
import com.github.kevindagame.voxelsniper.location.VoxelLocation;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -115,6 +115,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str
@Override
public List<String> registerArguments() {

return new ArrayList<>(Lists.newArrayList("air", "fill", "default"));
return Utils.newArrayList("air", "fill", "default");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.snipe.Undo;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.util.brushOperation.CustomOperation;
import com.github.kevindagame.util.brushOperation.CustomOperationContext;
import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType;
import com.github.kevindagame.voxelsniper.vector.VoxelVector;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -59,7 +58,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str
@Override
public List<String> registerArguments() {

return new ArrayList<>(Lists.newArrayList("big", "small"));
return new ArrayList<>(Utils.newArrayList("big", "small"));
}

@Override
Expand All @@ -81,7 +80,7 @@ public final void info(final VoxelMessage vm) {
}

@Override
public boolean perform(ImmutableList<CustomOperation> operations, @NotNull SnipeData snipeData, @NotNull Undo undo) {
public boolean perform(List<CustomOperation> operations, @NotNull SnipeData snipeData, @NotNull Undo undo) {
if (operations.size() != 2) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package com.github.kevindagame.brush
import com.github.kevindagame.snipe.SnipeData
import com.github.kevindagame.snipe.Undo
import com.github.kevindagame.util.brushOperation.CustomOperation
import com.google.common.collect.ImmutableList

abstract class CustomBrush : AbstractBrush() {
abstract fun perform(operations: ImmutableList<CustomOperation>, snipeData: SnipeData, undo: Undo): Boolean
abstract fun perform(operations: List<CustomOperation>, snipeData: SnipeData, undo: Undo): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Shapes;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -65,7 +65,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("smooth"));
arguments.addAll(Utils.newArrayList("smooth"));

arguments.addAll(super.registerArguments());
return arguments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.RotationAxis;
import com.github.kevindagame.util.Shapes;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.util.brushOperation.BlockOperation;
import com.github.kevindagame.voxelsniper.blockdata.waterlogged.IWaterlogged;
import com.github.kevindagame.voxelsniper.material.VoxelMaterial;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -79,6 +79,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str
@Override
public List<String> registerArguments() {

return new ArrayList<>(Lists.newArrayList("shape"));
return new ArrayList<>(Utils.newArrayList("shape"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.github.kevindagame.brush.perform.PerformerBrush;
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.block.IBlock;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -239,7 +239,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("x", "y", "t", "fill"));
arguments.addAll(Utils.newArrayList("x", "y", "t", "fill"));

arguments.addAll(super.registerArguments());
return arguments;
Expand All @@ -250,9 +250,9 @@ public List<String> registerArguments() {
public HashMap<String, List<String>> registerArgumentValues() {
HashMap<String, List<String>> argumentValues = new HashMap<>();

argumentValues.put("x", Lists.newArrayList("[number]"));
argumentValues.put("y", Lists.newArrayList("[number]"));
argumentValues.put("t", Lists.newArrayList("[number]"));
argumentValues.put("x", Utils.newArrayList("[number]"));
argumentValues.put("y", Utils.newArrayList("[number]"));
argumentValues.put("t", Utils.newArrayList("[number]"));

argumentValues.putAll(super.registerArgumentValues());
return argumentValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.github.kevindagame.brush.perform.PerformerBrush;
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.location.BaseLocation;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -112,7 +112,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("x", "y", "z"));
arguments.addAll(Utils.newArrayList("x", "y", "z"));

arguments.addAll(super.registerArguments());
return arguments;
Expand All @@ -123,9 +123,9 @@ public List<String> registerArguments() {
public HashMap<String, List<String>> registerArgumentValues() {
HashMap<String, List<String>> argumentValues = new HashMap<>();

argumentValues.put("x", Lists.newArrayList("[number]"));
argumentValues.put("y", Lists.newArrayList("[number]"));
argumentValues.put("z", Lists.newArrayList("[number]"));
argumentValues.put("x", Utils.newArrayList("[number]"));
argumentValues.put("y", Utils.newArrayList("[number]"));
argumentValues.put("z", Utils.newArrayList("[number]"));

argumentValues.putAll(super.registerArgumentValues());
return argumentValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.util.brushOperation.EntityRemoveOperation;
import com.github.kevindagame.voxelsniper.chunk.IChunk;
import com.github.kevindagame.voxelsniper.entity.IEntity;
import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -164,7 +164,7 @@ public void parseParameters(@NotNull final String triggerHandle, final String[]
@Override
public List<String> registerArguments() {

return new ArrayList<>(Lists.newArrayList("+", "-", "reset", "clear", "list"));
return new ArrayList<>(Utils.newArrayList("+", "-", "reset", "clear", "list"));
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@

import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.util.brushOperation.BlockOperation;
import com.github.kevindagame.voxelsniper.block.IBlock;
import com.github.kevindagame.voxelsniper.blockdata.IBlockData;
import com.github.kevindagame.voxelsniper.material.VoxelMaterial;
import com.github.kevindagame.voxelsniper.vector.VoxelVector;
import com.github.kevindagame.voxelsniper.world.IWorld;
import com.google.common.base.Objects;
import org.jetbrains.annotations.NotNull;

import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.jetbrains.annotations.NotNull;

/**
* <a href="https://github.com/KevinDaGame/VoxelSniper-Reimagined/wiki/Brushes#erode-brush">...</a>
*
Expand Down Expand Up @@ -331,14 +336,14 @@ public ErosionPreset(final int erosionFaces, final int erosionRecursion, final i

@Override
public int hashCode() {
return Objects.hashCode(erosionFaces, erosionRecursion, fillFaces, fillRecursion);
return Utils.hashCode(erosionFaces, erosionRecursion, fillFaces, fillRecursion);
}

@Override
public boolean equals(final Object obj) {
if (obj instanceof ErosionPreset) {
ErosionPreset other = (ErosionPreset) obj;
return Objects.equal(this.erosionFaces, other.erosionFaces) && Objects.equal(this.erosionRecursion, other.erosionRecursion) && Objects.equal(this.fillFaces, other.fillFaces) && Objects.equal(this.fillRecursion, other.fillRecursion);
return this.erosionFaces == other.erosionFaces && this.erosionRecursion == other.erosionRecursion && this.fillFaces == other.fillFaces && this.fillRecursion == other.fillRecursion;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.github.kevindagame.brush.perform.PerformerBrush;
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.block.IBlock;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
Expand Down Expand Up @@ -120,7 +120,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("smooth", "liquid", "existing"));
arguments.addAll(Utils.newArrayList("smooth", "liquid", "existing"));

arguments.addAll(super.registerArguments());
return arguments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import com.github.kevindagame.brush.perform.PerformerBrush;
import com.github.kevindagame.snipe.SnipeData;
import com.github.kevindagame.util.Messages;
import com.github.kevindagame.util.Utils;
import com.github.kevindagame.util.VoxelMessage;
import com.github.kevindagame.voxelsniper.block.IBlock;
import com.github.kevindagame.voxelsniper.location.BaseLocation;
import com.github.kevindagame.voxelsniper.vector.VoxelVector;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;

import java.util.*;
Expand Down Expand Up @@ -119,7 +119,7 @@ public final void parseParameters(final String triggerHandle, final String[] par
@Override
public List<String> registerArguments() {
List<String> arguments = new ArrayList<>();
arguments.addAll(Lists.newArrayList("recursion", "spread"));
arguments.addAll(Utils.newArrayList("recursion", "spread"));

arguments.addAll(super.registerArguments());
return arguments;
Expand All @@ -130,8 +130,8 @@ public List<String> registerArguments() {
public HashMap<String, List<String>> registerArgumentValues() {
HashMap<String, List<String>> argumentValues = new HashMap<>();

argumentValues.put("recursion", Lists.newArrayList("[number]"));
argumentValues.put("spread", Lists.newArrayList("[number]"));
argumentValues.put("recursion", Utils.newArrayList("[number]"));
argumentValues.put("spread", Utils.newArrayList("[number]"));

argumentValues.putAll(super.registerArgumentValues());
return argumentValues;
Expand Down
Loading

0 comments on commit 1aeaf0f

Please sign in to comment.