Skip to content

Commit

Permalink
refactor: use Location3dc instead of Location3d in SelectorArgument
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Feb 7, 2025
1 parent 97b5502 commit 731c493
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;

import java.util.Set;
Expand All @@ -27,7 +26,7 @@ public CachedSimpleSelectorArgument() {
}

@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
var value = cache.getIfPresent(Sets.newHashSet(arguments));
if (value == null) {
value = cache(selectorType, sender, basePos, arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -33,7 +32,7 @@ public interface SelectorArgument extends Comparable<SelectorArgument> {
*
* @throws SelectorSyntaxException if an error occurs while parsing the arguments.
*/
default Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
default Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -14,7 +14,7 @@
*/
public class DX extends ScopeArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -14,7 +14,7 @@
*/
public class DY extends ScopeArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -14,7 +14,7 @@
*/
public class DZ extends ScopeArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.command.selector.args.SelectorArgument;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -15,7 +15,7 @@
*/
public class R implements SelectorArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.command.selector.args.SelectorArgument;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -15,7 +15,7 @@
*/
public class RM implements SelectorArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -14,7 +14,7 @@
*/
public class X extends CoordinateArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);
basePos.x = ParseUtils.parseOffsetDouble(arguments[0], basePos.x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -14,7 +14,7 @@
*/
public class Y extends CoordinateArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);
basePos.y = ParseUtils.parseOffsetDouble(arguments[0], basePos.y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.allaymc.api.command.selector.SelectorSyntaxException;
import org.allaymc.api.command.selector.SelectorType;
import org.allaymc.api.entity.Entity;
import org.allaymc.api.math.location.Location3d;
import org.allaymc.api.math.location.Location3dc;
import org.allaymc.server.command.selector.ParseUtils;

import java.util.function.Predicate;
Expand All @@ -14,7 +14,7 @@
*/
public class Z extends CoordinateArgument {
@Override
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3d basePos, String... arguments) throws SelectorSyntaxException {
public Predicate<Entity> getPredicate(SelectorType selectorType, CommandSender sender, Location3dc basePos, String... arguments) throws SelectorSyntaxException {
ParseUtils.singleArgument(arguments, getKeyName());
ParseUtils.cannotReversed(arguments[0]);
basePos.z = ParseUtils.parseOffsetDouble(arguments[0], basePos.z);
Expand Down

0 comments on commit 731c493

Please sign in to comment.