From 00bc270b5da6722b5538ec7fcdcdf02a26be5269 Mon Sep 17 00:00:00 2001 From: Lennart99 <23156309+Lennart99@users.noreply.github.com> Date: Thu, 18 May 2023 11:34:09 +0200 Subject: [PATCH 1/2] Guava removal (#169) * started removing guava, doesn't build yet * changed BiMap into Map in SnipeTool * removed old code --- .../github/kevindagame/brush/AbstractBrush.kt | 9 +++--- .../github/kevindagame/brush/BlobBrush.java | 6 ++-- .../brush/CheckerVoxelDiscBrush.java | 4 +-- .../kevindagame/brush/CleanSnowBrush.java | 4 +-- .../kevindagame/brush/CloneStampBrush.java | 4 +-- .../github/kevindagame/brush/CometBrush.java | 7 ++--- .../github/kevindagame/brush/CustomBrush.kt | 3 +- .../kevindagame/brush/DiscFaceBrush.java | 4 +-- .../github/kevindagame/brush/DrainBrush.java | 4 +-- .../kevindagame/brush/EllipseBrush.java | 10 +++---- .../kevindagame/brush/EllipsoidBrush.java | 10 +++---- .../kevindagame/brush/EntityRemovalBrush.java | 4 +-- .../github/kevindagame/brush/ErodeBrush.java | 15 ++++++---- .../kevindagame/brush/FillDownBrush.java | 4 +-- .../kevindagame/brush/JaggedLineBrush.java | 8 ++--- .../github/kevindagame/brush/JockeyBrush.java | 7 ++--- .../kevindagame/brush/LightningBrush.java | 6 ++-- .../kevindagame/brush/OverlayBrush.java | 9 +++--- .../kevindagame/brush/PaintingBrush.java | 7 +++-- .../brush/RegenerateChunkBrush.java | 6 ++-- .../github/kevindagame/brush/RingBrush.java | 9 +++--- .../github/kevindagame/brush/Rot2DBrush.java | 7 +++-- .../kevindagame/brush/Rot2DvertBrush.java | 7 +++-- .../github/kevindagame/brush/Rot3DBrush.java | 13 ++++---- .../github/kevindagame/brush/RulerBrush.java | 7 +++-- .../kevindagame/brush/ScannerBrush.java | 12 ++++---- .../kevindagame/brush/SignOverwriteBrush.java | 19 ++++++++---- .../kevindagame/brush/SplatterBallBrush.java | 6 ---- .../kevindagame/brush/SplatterBrushBase.java | 13 ++++---- .../brush/SplatterOverlayBrush.java | 15 +++++----- .../github/kevindagame/brush/SplineBrush.java | 7 +++-- .../kevindagame/brush/UnderlayBrush.java | 9 +++--- .../kevindagame/brush/VoltMeterBrush.java | 7 +++-- .../brush/multiBlock/CanyonBrush.java | 6 ++-- .../brush/multiBlock/CopyPastaBrush.java | 6 ++-- .../brush/multiBlock/ExtrudeBrush.java | 4 +-- .../brush/multiBlock/FlatOceanBrush.java | 8 ++--- .../brush/multiBlock/GenerateTreeBrush.java | 30 +++++++++---------- .../brush/multiBlock/MoveBrush.java | 10 +++---- .../brush/multiBlock/OceanBrush.java | 11 +++---- .../brush/multiBlock/PullBrush.java | 7 +++-- .../brush/perform/PerformerBrush.java | 6 ++-- .../polymorphic/property/PerformerProperty.kt | 4 +-- .../polymorphic/property/PolyProperty.kt | 4 +-- .../kevindagame/command/MaterialCommand.java | 4 +-- .../command/VoxelBrushToolCommand.java | 8 ++--- .../command/VoxelPerformerCommand.java | 4 +-- .../command/VoxelSniperCommand.java | 6 ++-- .../command/VoxelVariablesCommand.java | 8 ++--- .../kevindagame/command/VoxelVoxCommand.java | 12 ++++---- .../github/kevindagame/snipe/SnipeTool.java | 27 +++++++---------- .../com/github/kevindagame/snipe/Sniper.java | 8 ++--- .../com/github/kevindagame/snipe/Undo.java | 4 +-- .../java/com/github/kevindagame/util/Utils.kt | 30 +++++++++++++++++++ .../github/kevindagame/util/VoxelList.java | 4 +-- .../events/player/PlayerSnipeEvent.java | 10 +++---- .../src/main/kotlin/voxel-core.gradle.kts | 1 - 57 files changed, 264 insertions(+), 220 deletions(-) create mode 100644 VoxelSniperCore/src/main/java/com/github/kevindagame/util/Utils.kt diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt index ed8b27aa..69670da4 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt @@ -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. @@ -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) { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java index fa2f54a3..0816c76d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java @@ -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; @@ -255,7 +255,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("growth")); + arguments.addAll(Utils.newArrayList("growth")); arguments.addAll(super.registerArguments()); return arguments; @@ -267,7 +267,7 @@ public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); - argumentValues.put("growth", Lists.newArrayList("[number]")); + argumentValues.put("growth", Utils.newArrayList("[number]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java index 14f10586..212dac84 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java @@ -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; @@ -70,7 +70,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("worldcoords")); + arguments.addAll(Utils.newArrayList("worldcoords")); arguments.addAll(super.registerArguments()); return arguments; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java index 53618ebc..75ce0b62 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java @@ -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; @@ -71,6 +71,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("smooth")); + return new ArrayList<>(Utils.newArrayList("smooth")); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java index b932db30..4bf0e15e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java @@ -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; @@ -115,6 +115,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("air", "fill", "default")); + return Utils.newArrayList("air", "fill", "default"); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java index 4bc80648..6a67c4cc 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java @@ -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; @@ -59,7 +58,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("big", "small")); + return new ArrayList<>(Utils.newArrayList("big", "small")); } @Override @@ -81,7 +80,7 @@ public final void info(final VoxelMessage vm) { } @Override - public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { if (operations.size() != 2) { return false; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CustomBrush.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CustomBrush.kt index 67f8c13f..cd93fd55 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CustomBrush.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CustomBrush.kt @@ -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, snipeData: SnipeData, undo: Undo): Boolean + abstract fun perform(operations: List, snipeData: SnipeData, undo: Undo): Boolean } \ No newline at end of file diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java index 0b3715be..77744fbe 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java @@ -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; @@ -65,7 +65,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("smooth")); + arguments.addAll(Utils.newArrayList("smooth")); arguments.addAll(super.registerArguments()); return arguments; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java index b3284c87..845b9fcd 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java @@ -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; @@ -79,6 +79,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("shape")); + return new ArrayList<>(Utils.newArrayList("shape")); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java index 2fb623f4..1647c02d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java @@ -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; @@ -239,7 +239,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List 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; @@ -250,9 +250,9 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> 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; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java index 2df2e350..78511b27 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java @@ -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; @@ -112,7 +112,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("x", "y", "z")); + arguments.addAll(Utils.newArrayList("x", "y", "z")); arguments.addAll(super.registerArguments()); return arguments; @@ -123,9 +123,9 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> 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; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java index 3b35ee3e..6f44577f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java @@ -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; @@ -164,7 +164,7 @@ public void parseParameters(@NotNull final String triggerHandle, final String[] @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("+", "-", "reset", "clear", "list")); + return new ArrayList<>(Utils.newArrayList("+", "-", "reset", "clear", "list")); } @NotNull diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java index d8799dbf..1e57f577 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java @@ -2,6 +2,7 @@ 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; @@ -9,12 +10,16 @@ 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; + /** * ... * @@ -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; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java index b89328f0..26283d23 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java @@ -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; @@ -120,7 +120,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("smooth", "liquid", "existing")); + arguments.addAll(Utils.newArrayList("smooth", "liquid", "existing")); arguments.addAll(super.registerArguments()); return arguments; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java index ff1a9411..632cb7e1 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java @@ -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.*; @@ -119,7 +119,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("recursion", "spread")); + arguments.addAll(Utils.newArrayList("recursion", "spread")); arguments.addAll(super.registerArguments()); return arguments; @@ -130,8 +130,8 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> 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; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java index 0381dfc2..e1648c30 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java @@ -3,6 +3,7 @@ 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; @@ -10,8 +11,6 @@ import com.github.kevindagame.voxelsniper.entity.IEntity; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -149,11 +148,11 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("inverse", "stack", "normal")); + return new ArrayList<>(Utils.newArrayList("inverse", "stack", "normal")); } @Override - public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { if (operations.size() != 1) return false; switch (Objects.requireNonNull(getSnipeAction())) { case GUNPOWDER: diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java index 0065cded..8a4a246d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java @@ -6,7 +6,9 @@ import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.util.brushOperation.CustomOperation; import com.github.kevindagame.util.brushOperation.CustomOperationContext; -import com.google.common.collect.ImmutableList; + +import java.util.List; + import org.jetbrains.annotations.NotNull; /** @@ -33,7 +35,7 @@ protected final void powder(final SnipeData v) { } @Override - public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { operations.forEach(operation -> operation.getLocation().getWorld().strikeLightning(operation.getLocation())); return true; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java index 9a1a6d36..ae71546f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java @@ -3,17 +3,18 @@ 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.VoxelList; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * ... * @@ -174,7 +175,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("depth", "mode")); + arguments.addAll(Utils.newArrayList("depth", "mode")); arguments.addAll(super.registerArguments()); return arguments; @@ -185,7 +186,7 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); - argumentValues.put("depth", Lists.newArrayList("[number]")); + argumentValues.put("depth", Utils.newArrayList("[number]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java index 40200a88..e1f758ce 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java @@ -6,11 +6,12 @@ import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.util.brushOperation.CustomOperation; import com.github.kevindagame.util.brushOperation.CustomOperationContext; -import com.google.common.collect.ImmutableList; -import org.jetbrains.annotations.NotNull; +import java.util.List; import java.util.Objects; +import org.jetbrains.annotations.NotNull; + /** * Painting scrolling Brush. ... * @@ -45,7 +46,7 @@ public final void info(final VoxelMessage vm) { } @Override - public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { switch (Objects.requireNonNull(getSnipeAction())) { case ARROW: BlockHelper.painting(snipeData.owner().getPlayer(), true, false, 0); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java index 57f4d742..06e12848 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java @@ -8,7 +8,9 @@ import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.ImmutableList; + +import java.util.List; + import org.jetbrains.annotations.NotNull; /** @@ -51,7 +53,7 @@ public final void info(final VoxelMessage vm) { } @Override - public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { final IChunk chunk = this.getTargetBlock().getChunk(); //check if no operationType has been cancelled by comparing the size to the amount of loops if (operations.stream().filter(o -> !o.isCancelled()).count() != originalSize) { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java index 57e3397f..e275e2f5 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java @@ -4,15 +4,16 @@ 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.voxelsniper.block.IBlock; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * ... * @@ -80,7 +81,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("smooth", "inner")); + arguments.addAll(Utils.newArrayList("smooth", "inner")); arguments.addAll(super.registerArguments()); return arguments; @@ -92,7 +93,7 @@ public HashMap> registerArgumentValues() { // Number variables HashMap> argumentValues = new HashMap<>(); - argumentValues.put("inner", Lists.newArrayList("[decimal]")); + argumentValues.put("inner", Utils.newArrayList("[decimal]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java index bdffb844..962bec27 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java @@ -6,13 +6,14 @@ 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.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * @author Piotr * ... @@ -63,6 +64,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("[number]")); + return new ArrayList<>(Utils.newArrayList("[number]")); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java index 7b157ef6..0593f632 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java @@ -5,13 +5,14 @@ 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.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; +import org.jetbrains.annotations.NotNull; + public class Rot2DvertBrush extends AbstractBrush { private double angle = 90; @@ -58,6 +59,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("[number]")); + return new ArrayList<>(Utils.newArrayList("[number]")); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java index c5031e68..a6ebe8d5 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java @@ -4,14 +4,15 @@ 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; import java.util.HashMap; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * ... */ @@ -73,7 +74,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("pitch", "roll", "yaw")); + return new ArrayList<>(Utils.newArrayList("pitch", "roll", "yaw")); } @NotNull @@ -82,9 +83,9 @@ public HashMap> registerArgumentValues() { // Number variables HashMap> argumentValues = new HashMap<>(); - argumentValues.put("pitch", Lists.newArrayList("[1-359]")); - argumentValues.put("roll", Lists.newArrayList("[1-359]")); - argumentValues.put("yaw", Lists.newArrayList("[1-359]")); + argumentValues.put("pitch", Utils.newArrayList("[1-359]")); + argumentValues.put("roll", Utils.newArrayList("[1-359]")); + argumentValues.put("yaw", Utils.newArrayList("[1-359]")); return argumentValues; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java index 6944be40..9eea54b3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java @@ -7,11 +7,12 @@ import com.github.kevindagame.util.brushOperation.CustomOperation; import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.vector.VoxelVector; -import com.google.common.collect.ImmutableList; -import org.jetbrains.annotations.NotNull; +import java.util.List; import java.util.Objects; +import org.jetbrains.annotations.NotNull; + /** * ... * @@ -58,7 +59,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str } @Override - public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { if (operations.size() != 1) { return false; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java index 3acf33c6..e55aed84 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java @@ -3,19 +3,19 @@ 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.block.BlockFace; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * @author DivineRage * ... @@ -89,7 +89,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("depth")); + return new ArrayList<>(Utils.newArrayList("depth")); } @NotNull @@ -98,13 +98,13 @@ public HashMap> registerArgumentValues() { // Number variables HashMap> argumentValues = new HashMap<>(); - argumentValues.put("depth", Lists.newArrayList("[number]")); + argumentValues.put("depth", Utils.newArrayList("[number]")); return argumentValues; } @Override - public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { if (operations.size() != 1) { return false; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java index 76314a0f..af1a2fd1 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java @@ -10,15 +10,22 @@ import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.blockstate.IBlockState; import com.github.kevindagame.voxelsniper.blockstate.sign.ISign; -import com.google.common.collect.ImmutableList; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import org.jetbrains.annotations.NotNull; -import java.io.*; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; import java.util.Arrays; +import java.util.List; import java.util.Objects; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; + +import org.jetbrains.annotations.NotNull; + /** * Overwrites signs. ... * @@ -374,7 +381,7 @@ public final void info(final VoxelMessage vm) { } @Override - public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { switch (Objects.requireNonNull(getSnipeAction())) { case ARROW -> { return false; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java index 1999fda6..4d125e56 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java @@ -3,12 +3,6 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; /** * ... diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java index ada037d8..5699e8af 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java @@ -3,15 +3,16 @@ 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.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Random; +import org.jetbrains.annotations.NotNull; + public abstract class SplatterBrushBase extends PerformerBrush { private static final int GROW_PERCENT_MIN = 1; private static final int GROW_PERCENT_DEFAULT = 1000; @@ -274,7 +275,7 @@ public boolean parseParams(final String triggerHandle, final String[] params, fi @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("recursion", "growth", "seed", "reset")); + arguments.addAll(Utils.newArrayList("recursion", "growth", "seed", "reset")); arguments.addAll(super.registerArguments()); return arguments; @@ -286,9 +287,9 @@ public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); // Number variables - argumentValues.put("recursion", Lists.newArrayList("[number]")); - argumentValues.put("seed", Lists.newArrayList("[number]")); - argumentValues.put("growth", Lists.newArrayList("[number]")); + argumentValues.put("recursion", Utils.newArrayList("[number]")); + argumentValues.put("seed", Utils.newArrayList("[number]")); + argumentValues.put("growth", Utils.newArrayList("[number]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java index 61ff572a..31c3ebcf 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java @@ -2,16 +2,17 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * ... * @@ -170,7 +171,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("recursion", "growth", "seed", "reset", "depth", "mode")); + arguments.addAll(Utils.newArrayList("recursion", "growth", "seed", "reset", "depth", "mode")); arguments.addAll(super.registerArguments()); return arguments; @@ -182,10 +183,10 @@ public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); // Number variables - argumentValues.put("recursion", Lists.newArrayList("[number]")); - argumentValues.put("depth", Lists.newArrayList("[number]")); - argumentValues.put("seed", Lists.newArrayList("[number]")); - argumentValues.put("growth", Lists.newArrayList("[number]")); + argumentValues.put("recursion", Utils.newArrayList("[number]")); + argumentValues.put("depth", Utils.newArrayList("[number]")); + argumentValues.put("seed", Utils.newArrayList("[number]")); + argumentValues.put("growth", Utils.newArrayList("[number]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java index 8c65a1a9..09c0fe96 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java @@ -3,16 +3,17 @@ 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.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.jetbrains.annotations.NotNull; + /** * FOR ANY BRUSH THAT USES A SPLINE, EXTEND THAT BRUSH FROM THIS BRUSH!!! That way, the spline calculations are already there. Also, the UI for the splines will * be included. @@ -203,7 +204,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("clear", "sc", "ss", "render")); + arguments.addAll(Utils.newArrayList("clear", "sc", "ss", "render")); arguments.addAll(super.registerArguments()); return arguments; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java index 59b2d7f7..78a2b32a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java @@ -3,17 +3,18 @@ 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.VoxelList; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * ... * @@ -158,7 +159,7 @@ public final void parseParameters(final String triggerHandle, final String[] par @Override public List registerArguments() { List arguments = new ArrayList<>(); - arguments.addAll(Lists.newArrayList("depth", "mode")); + arguments.addAll(Utils.newArrayList("depth", "mode")); arguments.addAll(super.registerArguments()); return arguments; @@ -169,7 +170,7 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); - argumentValues.put("depth", Lists.newArrayList("[number]")); + argumentValues.put("depth", Utils.newArrayList("[number]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java index 56371899..cb422f17 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java @@ -9,11 +9,12 @@ import com.github.kevindagame.voxelsniper.block.BlockFace; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.blockdata.redstoneWire.IRedstoneWire; -import com.google.common.collect.ImmutableList; -import org.jetbrains.annotations.NotNull; +import java.util.List; import java.util.Objects; +import org.jetbrains.annotations.NotNull; + /** * ... * @@ -59,7 +60,7 @@ public final void info(final VoxelMessage vm) { } @Override - public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull List operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { switch (Objects.requireNonNull(this.getSnipeAction())) { case ARROW: volt(snipeData); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java index fbaaf57e..e7beb3f6 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java @@ -3,12 +3,12 @@ import com.github.kevindagame.brush.AbstractBrush; 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.chunk.IChunk; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -104,7 +104,7 @@ public final void parseParameters(@NotNull String triggerHandle, final String[] @NotNull @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("y")); + return new ArrayList<>(Utils.newArrayList("y")); } @NotNull @@ -112,7 +112,7 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); - argumentValues.put("y", Lists.newArrayList("[number]")); + argumentValues.put("y", Utils.newArrayList("[number]")); return argumentValues; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java index 8fbff72d..15258ee1 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java @@ -4,11 +4,11 @@ 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.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -180,7 +180,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("rotate", "air")); + return new ArrayList<>(Utils.newArrayList("rotate", "air")); } @NotNull @@ -189,7 +189,7 @@ public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); - argumentValues.put("rotate", Lists.newArrayList("0", "90", "180", "270")); + argumentValues.put("rotate", Utils.newArrayList("0", "90", "180", "270")); return argumentValues; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java index 2ee15db1..d5b871f0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java @@ -3,11 +3,11 @@ import com.github.kevindagame.brush.AbstractBrush; 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.BlockFace; import com.github.kevindagame.voxelsniper.block.IBlock; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -161,6 +161,6 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("smooth")); + return new ArrayList<>(Utils.newArrayList("smooth")); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java index d6970b98..4111755f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java @@ -4,11 +4,11 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; 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.chunk.IChunk; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -114,7 +114,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("water", "floor")); + return new ArrayList<>(Utils.newArrayList("water", "floor")); } @NotNull @@ -122,8 +122,8 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); - argumentValues.put("water", Lists.newArrayList("[number]")); - argumentValues.put("floor", Lists.newArrayList("[number]")); + argumentValues.put("water", Utils.newArrayList("[number]")); + argumentValues.put("floor", Utils.newArrayList("[number]")); argumentValues.putAll(super.registerArgumentValues()); return argumentValues; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java index de47b6a5..c391a3a3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java @@ -3,6 +3,7 @@ import com.github.kevindagame.brush.AbstractBrush; 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; @@ -10,7 +11,6 @@ import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.location.VoxelLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -548,7 +548,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("leaves", "wood", "thickness", "startHeight", "branchLength", "slope", "rootLength", + return new ArrayList<>(Utils.newArrayList("leaves", "wood", "thickness", "startHeight", "branchLength", "slope", "rootLength", "rootFloat", "info", "rootMin", "rootMax", "minHeight", "maxHeight", "leavesMin", "leavesMax", "default")); } @@ -558,23 +558,23 @@ public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); // Number variables - argumentValues.put("thickness", Lists.newArrayList("[number]")); - argumentValues.put("startHeight", Lists.newArrayList("[number]")); - argumentValues.put("slope", Lists.newArrayList("[number]")); - argumentValues.put("branchLength", Lists.newArrayList("[number]")); - argumentValues.put("rootLength", Lists.newArrayList("[number]")); - argumentValues.put("rootMin", Lists.newArrayList("[number]")); - argumentValues.put("rootMax", Lists.newArrayList("[number]")); - argumentValues.put("minHeight", Lists.newArrayList("[number]")); - argumentValues.put("maxHeight", Lists.newArrayList("[number]")); - argumentValues.put("leavesMin", Lists.newArrayList("[number]")); - argumentValues.put("leavesMax", Lists.newArrayList("[number]")); + argumentValues.put("thickness", Utils.newArrayList("[number]")); + argumentValues.put("startHeight", Utils.newArrayList("[number]")); + argumentValues.put("slope", Utils.newArrayList("[number]")); + argumentValues.put("branchLength", Utils.newArrayList("[number]")); + argumentValues.put("rootLength", Utils.newArrayList("[number]")); + argumentValues.put("rootMin", Utils.newArrayList("[number]")); + argumentValues.put("rootMax", Utils.newArrayList("[number]")); + argumentValues.put("minHeight", Utils.newArrayList("[number]")); + argumentValues.put("maxHeight", Utils.newArrayList("[number]")); + argumentValues.put("leavesMin", Utils.newArrayList("[number]")); + argumentValues.put("leavesMax", Utils.newArrayList("[number]")); // Info variables - argumentValues.put("info", Lists.newArrayList("1", "2")); + argumentValues.put("info", Utils.newArrayList("1", "2")); // True/false variable - argumentValues.put("rootFloat", Lists.newArrayList("true", "false")); + argumentValues.put("rootFloat", Utils.newArrayList("true", "false")); // Wood material variables argumentValues.put("wood", VoxelMaterial.getMaterials().stream().map(VoxelMaterial::getName).collect(Collectors.toList())); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java index 0d8ea879..fc5cf79d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java @@ -4,13 +4,13 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; 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.location.BaseLocation; import com.github.kevindagame.voxelsniper.location.VoxelLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.world.IWorld; -import com.google.common.collect.Lists; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; @@ -155,7 +155,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("reset", "x", "y", "z")); + return new ArrayList<>(Utils.newArrayList("reset", "x", "y", "z")); } @NotNull @@ -163,9 +163,9 @@ public List registerArguments() { public HashMap> registerArgumentValues() { HashMap> 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]")); return argumentValues; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java index e76ab7f1..e445196e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java @@ -4,19 +4,20 @@ 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.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.world.IWorld; -import com.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * ...s#ocean-brush * @@ -193,7 +194,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("water", "floor")); + return new ArrayList<>(Utils.newArrayList("water", "floor")); } @NotNull @@ -202,10 +203,10 @@ public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); // Floor values - argumentValues.put("floor", Lists.newArrayList("true", "false")); + argumentValues.put("floor", Utils.newArrayList("true", "false")); // Number values - argumentValues.put("water", Lists.newArrayList("[number]")); + argumentValues.put("water", Utils.newArrayList("[number]")); return argumentValues; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java index f7498d2c..18db20f3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java @@ -3,17 +3,18 @@ import com.github.kevindagame.brush.AbstractBrush; 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.google.common.collect.Lists; -import org.jetbrains.annotations.NotNull; import java.util.HashSet; import java.util.List; +import org.jetbrains.annotations.NotNull; + /** * @author Piotr * ... @@ -77,7 +78,7 @@ public final void parseParameters(@NotNull final String triggerHandle, final Str @NotNull @Override public List registerArguments() { - return Lists.newArrayList("pinch", "bubble"); + return Utils.newArrayList("pinch", "bubble"); } /** diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java index 50fa817a..4d8c9d4a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java @@ -7,10 +7,10 @@ import com.github.kevindagame.brush.AbstractBrush; 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.events.player.PlayerBrushChangedEvent; import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -69,7 +69,7 @@ public void parseParameters(@NotNull String triggerHandle, @NotNull String[] par @Override public List registerArguments() { - return new ArrayList<>(Lists.newArrayList("p")); + return new ArrayList<>(Utils.newArrayList("p")); } @NotNull @@ -77,7 +77,7 @@ public List registerArguments() { public HashMap> registerArgumentValues() { // Number variables HashMap> argumentValues = new HashMap<>(); - argumentValues.put("p", Lists.newArrayList(Performer.getPerformerHandles())); + argumentValues.put("p", Utils.newArrayList(Performer.getPerformerHandles())); return argumentValues; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PerformerProperty.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PerformerProperty.kt index 798b2ddc..48c96d97 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PerformerProperty.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PerformerProperty.kt @@ -3,9 +3,9 @@ package com.github.kevindagame.brush.polymorphic.property import com.github.kevindagame.brush.perform.BasePerformer import com.github.kevindagame.brush.perform.Performer import com.github.kevindagame.brush.perform.pMaterial -import com.google.common.collect.ImmutableList +import com.github.kevindagame.util.Utils -class PerformerProperty : PolyProperty("performer", "Set the performer", pMaterial(), aliases = ImmutableList.of("p")) { +class PerformerProperty : PolyProperty("performer", "Set the performer", pMaterial(), aliases = Utils.unmodifiableList("P")) { override fun set(value: String?) { val newPerfomer = Performer.getPerformer(value) ?: return this.value = newPerfomer diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PolyProperty.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PolyProperty.kt index 7eab8b75..6bcf4f07 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PolyProperty.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/polymorphic/property/PolyProperty.kt @@ -1,8 +1,8 @@ package com.github.kevindagame.brush.polymorphic.property -import com.google.common.collect.ImmutableList +import com.github.kevindagame.util.Utils -abstract class PolyProperty(val name: String, val description: String, val default: T, val aliases: ImmutableList = ImmutableList.of()) { +abstract class PolyProperty(val name: String, val description: String, val default: T, val aliases: List = Utils.unmodifiableList()) { var value: T = default fun get(): T { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java index f7c39d92..c5b1fe84 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java @@ -1,8 +1,8 @@ package com.github.kevindagame.command; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; @@ -30,7 +30,7 @@ public List doSuggestion(IPlayer player, String[] args) { if (args[0].startsWith("minecraft:")) { return getTabCompletion(1).stream().map(e -> "minecraft:" + e).toList(); } else if (args[0].startsWith("mi")) { - return Lists.newArrayList("minecraft:"); + return Utils.newArrayList("minecraft:"); } else { return getTabCompletion(1); } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java index e99d228c..7cfbedd4 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java @@ -3,9 +3,9 @@ import com.github.kevindagame.snipe.SnipeAction; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.Arrays; @@ -98,18 +98,18 @@ public boolean doCommand(IPlayer player, String[] args) { @Override public List doSuggestion(IPlayer player, String[] args) { if (args.length == 1) { - return Lists.newArrayList("assign", "remove"); + return Utils.newArrayList("assign", "remove"); } if (args.length == 2) { if (args[0].equalsIgnoreCase("assign")) { - return Lists.newArrayList("arrow", "powder"); + return Utils.newArrayList("arrow", "powder"); } } if (args.length == 3) { if (args[0].equalsIgnoreCase("assign")) { - return Lists.newArrayList("[label]"); + return Utils.newArrayList("[label]"); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java index 4ddc4f93..a9d3cc04 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java @@ -7,8 +7,8 @@ import com.github.kevindagame.brush.polymorphic.property.PerformerProperty; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; @@ -23,7 +23,7 @@ public VoxelPerformerCommand() { @Override public List registerTabCompletion() { - return Lists.newArrayList(Performer.getPerformerHandles()); + return Utils.newArrayList(Performer.getPerformerHandles()); } @Override diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java index 3c49c230..c1e0ca33 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java @@ -3,8 +3,8 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; @@ -78,12 +78,12 @@ public boolean doCommand(IPlayer player, String[] args) { @Override public List doSuggestion(IPlayer player, String[] args) { if (args.length == 1) { - return Lists.newArrayList("enable", "disable", "range"); + return Utils.newArrayList("enable", "disable", "range"); } if (args.length == 2) { if (args[0].equalsIgnoreCase("range")) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java index 3a787455..86bbb8e0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java @@ -3,9 +3,9 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.Arrays; @@ -151,7 +151,7 @@ private void checkMaterial(String string, List invalidMaterials, SnipeDa public List doSuggestion(IPlayer player, String[] args) { if (getActiveAlias().equalsIgnoreCase("vc") || getActiveAlias().equals("vh")) { if (args.length == 1) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } @@ -164,12 +164,12 @@ public List doSuggestion(IPlayer player, String[] args) { if (getActiveIdentifier().equalsIgnoreCase(getIdentifier())) { if (args.length == 1) { - return Lists.newArrayList("list", "center", "height"); + return Utils.newArrayList("list", "center", "height"); } if (args[0].equalsIgnoreCase("center") || args[0].equals("height")) { if (args.length == 2) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java index 47664f34..a7384e1b 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java @@ -2,9 +2,9 @@ import com.github.kevindagame.util.BlockHelper; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Utils; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; @@ -113,30 +113,30 @@ public boolean doCommand(IPlayer player, String[] args) { public List doSuggestion(IPlayer player, String[] args) { if (getActiveAlias().equalsIgnoreCase("painting")) { if (args.length == 1) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } if (getActiveAlias().equalsIgnoreCase("goto")) { if (args.length <= 2) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } if (getActiveIdentifier().equalsIgnoreCase("vox")) { if (args.length == 1) { - return Lists.newArrayList("goto", "painting", "chunk"); + return Utils.newArrayList("goto", "painting", "chunk"); } if (args[0].equalsIgnoreCase("painting")) { if (args.length == 2) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } if (args[0].equalsIgnoreCase("goto")) { if (args.length <= 3) { - return Lists.newArrayList("[number]"); + return Utils.newArrayList("[number]"); } } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/SnipeTool.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/SnipeTool.java index b9a92992..144efa9d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/SnipeTool.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/SnipeTool.java @@ -2,16 +2,13 @@ import com.github.kevindagame.VoxelBrushManager; import com.github.kevindagame.brush.IBrush; -import com.github.kevindagame.brush.SnipeBrush; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableBiMap; -import java.util.Objects; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -19,7 +16,7 @@ */ public class SnipeTool { - private final BiMap actionTools = HashBiMap.create(); + private final Map actionTools = new HashMap<>(); private IBrush currentBrush; private IBrush previousBrush = null; private final VoxelMessage messageHelper; @@ -45,7 +42,7 @@ public SnipeData getSnipeData() { } public boolean hasToolAssigned(VoxelMaterial material) { - return actionTools.containsValue(material); + return actionTools.containsKey(material); } public VoxelMessage getMessageHelper() { @@ -64,7 +61,7 @@ public VoxelMessage getMessageHelper() { } public void unassignAction(VoxelMaterial itemInHand) { - actionTools.inverse().remove(itemInHand); + actionTools.remove(itemInHand); } public IBrush setCurrentBrush(IBrush brush) { @@ -74,20 +71,16 @@ public IBrush setCurrentBrush(IBrush brush) { } public SnipeAction getActionAssigned(VoxelMaterial itemInHand) { - return actionTools.inverse().get(itemInHand); + return actionTools.get(itemInHand); } - public VoxelMaterial getToolAssigned(SnipeAction action) { - return actionTools.get(action); - } - - public BiMap getActionTools() { - return ImmutableBiMap.copyOf(actionTools); + public Map getActionTools() { + return Collections.unmodifiableMap(this.actionTools); } public void assignAction(SnipeAction action, VoxelMaterial itemInHand) { - actionTools.forcePut(action, itemInHand); + actionTools.put(itemInHand, action); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java index a4a7a7f8..b28fc2c1 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java @@ -13,11 +13,11 @@ import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Maps; import net.kyori.adventure.text.ComponentLike; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashMap; import java.util.LinkedList; import java.util.Map; @@ -28,7 +28,7 @@ public class Sniper { public final IPlayer player; private final LinkedList undoList = new LinkedList<>(); - private final Map tools = Maps.newHashMap(); + private final Map tools = new HashMap<>(); private boolean enabled = true; public Sniper(IPlayer player) { @@ -257,8 +257,8 @@ public void reset(String toolId) { SnipeTool backup = tools.remove(toolId); SnipeTool newTool = new SnipeTool(this); - for (Map.Entry entry : backup.getActionTools().entrySet()) { - newTool.assignAction(entry.getKey(), entry.getValue()); + for (Map.Entry entry : backup.getActionTools().entrySet()) { + newTool.assignAction(entry.getValue(), entry.getKey()); } tools.put(toolId, newTool); } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java index cf958b09..55704a1d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java @@ -4,9 +4,9 @@ import com.github.kevindagame.voxelsniper.blockstate.IBlockState; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.vector.VoxelVector; -import com.google.common.collect.Sets; import java.util.Arrays; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -19,7 +19,7 @@ public class Undo { private static final List FALLING_MATERIALS = Arrays.asList( VoxelMaterial.WATER, VoxelMaterial.LAVA); - private final Set containing = Sets.newHashSet(); + private final Set containing = new HashSet<>(); private final List all; private final List falloff; private final List dropdown; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Utils.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Utils.kt new file mode 100644 index 00000000..ba5c509d --- /dev/null +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Utils.kt @@ -0,0 +1,30 @@ +package com.github.kevindagame.util + +import java.util.* + +object Utils { + fun unmodifiableList(): List { + return Collections.unmodifiableList(ArrayList()) + } + + fun unmodifiableList(arg: T): List { + return Collections.unmodifiableList(newArrayList(arg)) + } + + @JvmStatic + fun newArrayList(vararg args: T): List { + val lst: MutableList = ArrayList() + lst.addAll(args) + return lst + } + + @JvmStatic + fun newArrayList(lst: Collection): List { + return ArrayList(lst); + } + + @JvmStatic + fun hashCode(vararg args: Int): Int { + return args.contentHashCode(); + } +} diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java index 42089056..1173bc34 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java @@ -1,9 +1,9 @@ package com.github.kevindagame.util; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.ImmutableList; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -51,7 +51,7 @@ public boolean isEmpty() { * @return defensive copy of the List with pairs */ public List getList() { - return ImmutableList.copyOf(materials); + return Collections.unmodifiableList(materials); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java index 0c3e891d..95bb0c9f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java @@ -6,20 +6,20 @@ import com.github.kevindagame.voxelsniper.events.Cancellable; import com.github.kevindagame.voxelsniper.events.EventPriority; import com.github.kevindagame.voxelsniper.events.HandlerList; -import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; +import java.util.List; import java.util.function.Consumer; public class PlayerSnipeEvent extends PlayerEvent implements Cancellable { private static final HandlerList handlers = new HandlerList<>(); private final IBrush brush; - private final ImmutableList operations; + private final List operations; private boolean isCustom; private EventResult status; - public PlayerSnipeEvent(final IPlayer p, final IBrush brush, ImmutableList operations) { + public PlayerSnipeEvent(final IPlayer p, final IBrush brush, List operations) { super(p); this.brush = brush; this.status = EventResult.DEFAULT; @@ -27,7 +27,7 @@ public PlayerSnipeEvent(final IPlayer p, final IBrush brush, ImmutableList operations, boolean isCustom) { + public PlayerSnipeEvent(final IPlayer p, final IBrush brush, List operations, boolean isCustom) { this(p, brush, operations); this.isCustom = isCustom; } @@ -44,7 +44,7 @@ public IBrush getBrush() { return brush; } - public ImmutableList getOperations() { + public List getOperations() { return operations; } diff --git a/buildSrc/src/main/kotlin/voxel-core.gradle.kts b/buildSrc/src/main/kotlin/voxel-core.gradle.kts index c3e999e8..f0249c40 100644 --- a/buildSrc/src/main/kotlin/voxel-core.gradle.kts +++ b/buildSrc/src/main/kotlin/voxel-core.gradle.kts @@ -33,7 +33,6 @@ dependencies { implementation("net.kyori:adventure-text-serializer-legacy:4.13.1") implementation(kotlin("stdlib-jdk8")) - implementation("com.google.guava:guava:31.1-jre") implementation("com.google.code.gson:gson:2.10.1") implementation("org.yaml:snakeyaml:1.33") From bd563c0f006adf6c5f54130d5db79dfea91230c6 Mon Sep 17 00:00:00 2001 From: KevDaDev <65958288+KevinDaGame@users.noreply.github.com> Date: Thu, 18 May 2023 13:30:10 +0200 Subject: [PATCH 2/2] Bump version (#170) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f47f218b..1846d93d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -voxelsniper.version=8.8.0 \ No newline at end of file +voxelsniper.version=8.8.1 \ No newline at end of file