Skip to content

Commit

Permalink
Use Handle position
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed May 24, 2024
1 parent 9775c9d commit bbad228
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,30 @@ public void register() {
.replace("{name}", "@e[{data}]"
.replace("{data}", "x=" + entity.getLocation().getX() + ",y=" + entity.getLocation().getY() + ",z=" + entity.getLocation().getZ() + ",type=" + entity.getType().toString().toLowerCase() + ",x_rotation=" + entity.getLocation().getDirection().getX() + ",y_rotation=" + entity.getLocation().getDirection().getY())
);
RaycastUtils.executeNMSCommand(((CraftEntity) entity).getHandle(), CraftLocation.toVec3D(entity.getLocation()), cmd);
RaycastUtils.executeNMSCommand(((CraftEntity) entity).getHandle(), ((CraftEntity) entity).getHandle().position(), cmd);
}
}));
register(new ActionFactory(GenesisMC.apoliIdentifier("remove_power"), (action, entity) -> {
if (entity instanceof Player p) {
PowerType powerContainer = GenesisMC.getPlugin().registry.retrieve(Registries.CRAFT_POWER).get(action.getNamespacedKey("power"));
if (powerContainer != null) {
RaycastUtils.executeNMSCommand(((CraftEntity) p).getHandle(), CraftLocation.toVec3D(p.getLocation()), "power remove {name} {identifier}".replace("{name}", p.getName()).replace("{identifier}", action.getString("power")));
RaycastUtils.executeNMSCommand(((CraftEntity) p).getHandle(), ((CraftEntity) p).getHandle().position(), "power remove {name} {identifier}".replace("{name}", p.getName()).replace("{identifier}", action.getString("power")));
}
}
}));
register(new ActionFactory(GenesisMC.apoliIdentifier("grant_power"), (action, entity) -> {
if (entity instanceof Player p) {
PowerType powerContainer = GenesisMC.getPlugin().registry.retrieve(Registries.CRAFT_POWER).get(action.getNamespacedKey("power"));
if (powerContainer != null) {
RaycastUtils.executeNMSCommand(((CraftEntity) p).getHandle(), CraftLocation.toVec3D(p.getLocation()), "power grant {name} {identifier}".replace("{name}", p.getName()).replace("{identifier}", action.getString("power")));
RaycastUtils.executeNMSCommand(((CraftEntity) p).getHandle(), ((CraftEntity) p).getHandle().position(), "power grant {name} {identifier}".replace("{name}", p.getName()).replace("{identifier}", action.getString("power")));
}
}
}));
register(new ActionFactory(GenesisMC.apoliIdentifier("revoke_power"), (action, entity) -> {
if (entity instanceof Player p) {
PowerType powerContainer = GenesisMC.getPlugin().registry.retrieve(Registries.CRAFT_POWER).get(action.getNamespacedKey("power"));
if (powerContainer != null) {
RaycastUtils.executeNMSCommand(((CraftEntity) p).getHandle(), CraftLocation.toVec3D(p.getLocation()), "power revoke {name} {identifier}".replace("{name}", p.getName()).replace("{identifier}", action.getString("power")));
RaycastUtils.executeNMSCommand(((CraftEntity) p).getHandle(), ((CraftEntity) p).getHandle().position(), "power revoke {name} {identifier}".replace("{name}", p.getName()).replace("{identifier}", action.getString("power")));
}
}
}));
Expand Down Expand Up @@ -470,7 +470,7 @@ public void register() {
if (cmd.startsWith("scale") && cmd.endsWith(" @s")) {
cmd = cmd.replace(" @s", ""); // Remove any specified player arg
}
RaycastUtils.executeNMSCommand(((CraftEntity) entity).getHandle(), CraftLocation.toVec3D(entity.getLocation()), cmd);
RaycastUtils.executeNMSCommand(((CraftEntity) entity).getHandle(), ((CraftEntity) entity).getHandle().position(), cmd);
}));
register(new ActionFactory(GenesisMC.apoliIdentifier("add_xp"), (action, entity) -> {
int points = 0;
Expand Down

0 comments on commit bbad228

Please sign in to comment.