Skip to content

Commit

Permalink
Merge pull request #84 from JustAHuman-xD/fix/aura-skills-regions
Browse files Browse the repository at this point in the history
[Fix] Aura Skills not recognizing Wand modified Blocks
  • Loading branch information
GallowsDove authored Aug 6, 2024
2 parents 0028aa9 + 1a3286e commit abbd7dd
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>dev.aurelium</groupId>
<artifactId>auraskills-api-bukkit</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.github.Mooy1</groupId>
<artifactId>InfinityLib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
import me.gallowsdove.foxymachines.FoxyMachines;
import me.gallowsdove.foxymachines.Items;
import me.gallowsdove.foxymachines.utils.AuraSkillsCompat;
import me.gallowsdove.foxymachines.utils.SimpleLocation;
import me.gallowsdove.foxymachines.utils.Utils;
import org.bukkit.*;
Expand Down Expand Up @@ -123,7 +124,12 @@ protected ItemUseHandler onUse() {
if (removeItemCharge(e.getItem(), getCostPerBlock() * locs.size())) {
inventory.removeItem(blocks);
for (Location loc : locs) {
Bukkit.getScheduler().runTask(FoxyMachines.getInstance(), () -> loc.getBlock().setType(material));
Bukkit.getScheduler().runTask(FoxyMachines.getInstance(), () -> {
loc.getBlock().setType(material);
if (Utils.isAuraSkillsLoaded()) {
AuraSkillsCompat.addPlacedBlock(loc.getBlock());
}
});
}
} else {
player.sendMessage(ChatColor.RED + "Your item doesn't have enough energy for that!");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package me.gallowsdove.foxymachines.utils;

import dev.aurelium.auraskills.api.AuraSkillsBukkitProvider;
import dev.aurelium.auraskills.api.region.Regions;
import org.bukkit.block.Block;

public class AuraSkillsCompat {
public static void addPlacedBlock(Block block) {
Regions regions = AuraSkillsBukkitProvider.getInstance().getRegions();
if (regions != null) {
regions.addPlacedBlock(block);
}
}
}
5 changes: 5 additions & 0 deletions src/main/java/me/gallowsdove/foxymachines/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Bukkit;

import javax.annotation.Nonnull;

public class Utils {
private Utils() {}

public static boolean isAuraSkillsLoaded() {
return Bukkit.getPluginManager().isPluginEnabled("AuraSkills");
}

public static void dealDamageBypassingArmor(LivingEntity entity, double damage) {
if (damage >= 0) {
if (entity.getAbsorptionAmount() >= 0) {
Expand Down
20 changes: 3 additions & 17 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
## CHANGE this to the name of your plugin.
name: FoxyMachines
main: me.gallowsdove.foxymachines.FoxyMachines

## CHANGE this to your username.
author: GallowsDove

## CHANGE this to a meaninful but short description of your plugin.
description: Adds tools, machines, items, armor, weapons, bosses and more!

## CHANGE this to the path of the class that extends JavaPlugin.
main: me.gallowsdove.foxymachines.FoxyMachines

## You can change this to link to your website or repository. You can also remove this line if you want to.
website: https://github.com/GallowsDove/FoxyMachines

## This is required and marks Slimefun as a plugin dependency.
depend: [Slimefun]

## This value is automatically replaced by the version specified in your pom.xml file, do not change this.
softdepend: [AuraSkills]
version: ${project.version}

## This is the minimum minecraft version required to run your plugin.
api-version: 1.16

## Commands
commands:
foxymachines:
description: foxymachines main command
usage: /foxymachines <subcommand>
aliases: [fm, foxy]

## Permissions
permissions:
foxymachines.bypass-chunk-loader-limit:
description: Allows a player with the permission to place an unlimited amount of chunk loaders
Expand All @@ -39,4 +25,4 @@ permissions:
default: op
foxymachines.info:
description: Gives players access to basic FoxyMachines commands. Should never be revoked.
default: true
default: true

0 comments on commit abbd7dd

Please sign in to comment.