Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed Apr 3, 2024
1 parent f74b9d6 commit be56170
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 3 deletions.
19 changes: 18 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxSellwands</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<packaging>jar</packaging>

<name>AxSellwands</name>
Expand Down Expand Up @@ -126,6 +126,10 @@
<id>william278.net</id>
<url>https://repo.william278.net/releases</url>
</repository>
<repository>
<id>glaremasters repo</id>
<url>https://repo.glaremasters.me/repository/towny/</url>
</repository>
</repositories>

<dependencyManagement>
Expand Down Expand Up @@ -344,6 +348,19 @@
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>towny</artifactId>
<version>0.100.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.sat7</groupId>
<artifactId>dynamicshop</artifactId>
<version>3.16.1</version>
<systemPath>${project.basedir}/libs/DynamicShop-3.16.1.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
import com.artillexstudios.axsellwands.hooks.protection.ProtectionHook;
import com.artillexstudios.axsellwands.hooks.protection.ResidenceHook;
import com.artillexstudios.axsellwands.hooks.protection.SuperiorSkyBlock2Hook;
import com.artillexstudios.axsellwands.hooks.protection.TownyHook;
import com.artillexstudios.axsellwands.hooks.protection.WorldGuardHook;
import com.artillexstudios.axsellwands.hooks.shop.AxGensHook;
import com.artillexstudios.axsellwands.hooks.shop.BuiltinPrices;
import com.artillexstudios.axsellwands.hooks.shop.CMIPricesHook;
import com.artillexstudios.axsellwands.hooks.shop.DynamicShop3Hook;
import com.artillexstudios.axsellwands.hooks.shop.EconomyShopGuiHook;
import com.artillexstudios.axsellwands.hooks.shop.EssentialsHook;
import com.artillexstudios.axsellwands.hooks.shop.PricesHook;
Expand Down Expand Up @@ -97,6 +99,11 @@ public static void setupHooks() {
PROTECTION_HOOKS.add(new HuskTownsHook());
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#33FF33[AxSellwands] Hooked into HuskTowns!"));
}

if (HOOKS.getBoolean("hook-settings.Towny.register", true) && Bukkit.getPluginManager().getPlugin("Towny") != null) {
PROTECTION_HOOKS.add(new TownyHook());
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#33FF33[AxSellwands] Hooked into Towny!"));
}
}

public static void updateHooks() {
Expand Down Expand Up @@ -197,6 +204,16 @@ public static void updateHooks() {
break;
}

case "DYNAMICSHOP": {
if (Bukkit.getPluginManager().getPlugin("DynamicShop") != null) {
shopPrices = new DynamicShop3Hook();
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#33FF33[AxSellwands] Hooked into DynamicShop!"));
} else {
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF3333[AxSellwands] DynamicShop is set in hooks.yml, but it is not installed, please download it or change it to stop errors!"));
}
break;
}

default: {
shopPrices = new BuiltinPrices();
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#33FF33[AxSellwands] Using builtin prices!"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.artillexstudios.axsellwands.hooks.protection;

import com.palmergames.bukkit.towny.object.TownyPermission;
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class TownyHook implements ProtectionHook {

public boolean canPlayerBuildAt(@NotNull Player player, @NotNull Location location) {
return PlayerCacheUtil.getCachePermission(player, location, Material.STONE, TownyPermission.ActionType.BUILD);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.artillexstudios.axsellwands.hooks.shop;

import me.sat7.dynamicshop.DynaShopAPI;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

public class DynamicShop3Hook implements PricesHook {

@Override
public void setup() {
}

@Override
public double getPrice(ItemStack it) {
double most = -1.0D;
for (String str : DynaShopAPI.getShops()) {
most = Math.max(DynaShopAPI.getBuyPrice(str, it), most);
}
if (most == -1.0D) return most;
return most * it.getAmount();
}

@Override
public double getPrice(Player player, ItemStack it) {
return getPrice(it);
}
}
12 changes: 11 additions & 1 deletion src/main/resources/hooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
hooks:
# values: Vault, PlayerPoints, CoinsEngine, RoyaleEconomy, custom
economy-plugin: "Vault"
# values: builtin, AxGens, ShopGUIPlus, Essentials, EconomyShopGUI, CMI, custom
# values:
# - builtin
# - AxGens
# - ShopGUIPlus
# - Essentials
# - EconomyShopGUI
# - DynamicShop
# - CMI
# - custom
price-plugin: "builtin"

hook-settings:
Expand All @@ -26,6 +34,8 @@ hook-settings:
register: true
HuskTowns:
register: true
Towny:
register: true
# other
PlaceholderAPI:
register: true
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ softdepend:
- WorldGuard
- SuperiorSkyblock2
- IridiumSkyBlock
- HuskTowns
- HuskTowns
- Towny
- DynamicShop

0 comments on commit be56170

Please sign in to comment.