This commit is contained in:
BenceX100 2024-05-19 18:57:56 +02:00
parent 37f04944f9
commit bd508c1d5e
6 changed files with 261 additions and 248 deletions

481
pom.xml
View File

@ -2,255 +2,252 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.artillexstudios</groupId> <groupId>com.artillexstudios</groupId>
<artifactId>AxTrade</artifactId> <artifactId>AxTrade</artifactId>
<version>1.0.0</version> <version>1.1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>AxTrade</name> <name>AxTrade</name>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration> <configuration>
<createDependencyReducedPom>false</createDependencyReducedPom> <source>12</source>
<relocations> <target>12</target>
<relocation> <compilerArgs>
<pattern>com.artillexstudios.axapi</pattern> <arg>-parameters</arg>
<shadedPattern>com.artillexstudios.axtrade.libs.axapi</shadedPattern> </compilerArgs>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>dev.triumphteam.gui</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.gui</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.kyori</shadedPattern>
</relocation>
<relocation>
<pattern>revxrsal.commands</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.lamp</shadedPattern>
</relocation>
</relocations>
</configuration> </configuration>
</execution> </plugin>
</executions> <plugin>
</plugin> <groupId>org.apache.maven.plugins</groupId>
</plugins> <artifactId>maven-shade-plugin</artifactId>
<resources> <version>3.5.3</version>
<resource> <executions>
<directory>src/main/resources</directory> <execution>
<filtering>true</filtering> <phase>package</phase>
</resource> <goals>
</resources> <goal>shade</goal>
</build> </goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>com.artillexstudios.axapi</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.axapi</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>dev.triumphteam.gui</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.gui</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.kyori</shadedPattern>
</relocation>
<relocation>
<pattern>revxrsal.commands</pattern>
<shadedPattern>com.artillexstudios.axtrade.libs.lamp</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories> <repositories>
<repository> <repository>
<id>Artillex-Studios</id> <id>Artillex-Studios</id>
<url>https://repo.artillex-studios.com/releases/</url> <url>https://repo.artillex-studios.com/releases/</url>
</repository> </repository>
<repository> <repository>
<id>spigotmc-repo</id> <id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository> </repository>
<repository> <repository>
<id>sonatype</id> <id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url> <url>https://oss.sonatype.org/content/groups/public/</url>
</repository> </repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
</repository> </repository>
<repository> <repository>
<id>placeholderapi</id> <id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository> </repository>
<repository> <repository>
<id>techscode</id> <id>techscode</id>
<url>https://repo.techscode.com/repository/maven-releases/</url> <url>https://repo.techscode.com/repository/maven-releases/</url>
</repository> </repository>
<repository> <repository>
<id>rosewood-repo</id> <id>rosewood-repo</id>
<url>https://repo.rosewooddev.io/repository/public/</url> <url>https://repo.rosewooddev.io/repository/public/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.artillexstudios.axapi</groupId> <groupId>com.artillexstudios.axapi</groupId>
<artifactId>axapi</artifactId> <artifactId>axapi</artifactId>
<version>1.4.232</version> <version>1.4.234</version>
<scope>compile</scope> <scope>compile</scope>
<classifier>all</classifier> <classifier>all</classifier>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version> <version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.triumphteam</groupId> <groupId>dev.triumphteam</groupId>
<artifactId>triumph-gui</artifactId> <artifactId>triumph-gui</artifactId>
<version>3.1.7</version> <version>3.1.7</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.11.5</version> <version>2.11.5</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId> <artifactId>bstats-bukkit</artifactId>
<version>3.0.2</version> <version>3.0.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId> <artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.2</version> <version>4.3.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId> <artifactId>adventure-text-minimessage</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId> <artifactId>adventure-text-serializer-legacy</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId> <artifactId>adventure-api</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.aglerr.mobcoins</groupId> <groupId>me.aglerr.mobcoins</groupId>
<artifactId>MobCoins</artifactId> <artifactId>MobCoins</artifactId>
<version>1.1.3</version> <version>1.1.3</version>
<systemPath>${project.basedir}/libs/TheOnly-MobCoins-1.1.3.jar</systemPath> <systemPath>${project.basedir}/libs/TheOnly-MobCoins-1.1.3.jar</systemPath>
<scope>system</scope> <scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.artillexstudios</groupId> <groupId>com.artillexstudios</groupId>
<artifactId>AxQuestBoardAPI</artifactId> <artifactId>AxQuestBoardAPI</artifactId>
<version>1</version> <version>1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.Realizedd</groupId> <groupId>com.github.Realizedd</groupId>
<artifactId>TokenManager</artifactId> <artifactId>TokenManager</artifactId>
<version>3.2.4</version> <version>3.2.4</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>*</groupId> <groupId>*</groupId>
<artifactId>*</artifactId> <artifactId>*</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.swanis.mobcoins</groupId> <groupId>me.swanis.mobcoins</groupId>
<artifactId>MobCoins</artifactId> <artifactId>MobCoins</artifactId>
<version>1.1.2</version> <version>1.1.2</version>
<systemPath>${project.basedir}/libs/mobcoins-api-1.1.2-SNAPSHOT.jar</systemPath> <systemPath>${project.basedir}/libs/mobcoins-api-1.1.2-SNAPSHOT.jar</systemPath>
<scope>system</scope> <scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.rivaldev.harvesterhoes</groupId> <groupId>me.rivaldev.harvesterhoes</groupId>
<artifactId>Main</artifactId> <artifactId>Main</artifactId>
<version>LATEST</version> <version>LATEST</version>
<systemPath>${project.basedir}/libs/RivalHarvesterHoesAPI.jar</systemPath> <systemPath>${project.basedir}/libs/RivalHarvesterHoesAPI.jar</systemPath>
<scope>system</scope> <scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.cryptomorin</groupId> <groupId>com.github.cryptomorin</groupId>
<artifactId>kingdoms</artifactId> <artifactId>kingdoms</artifactId>
<version>LATEST</version> <version>LATEST</version>
<systemPath>${project.basedir}/libs/KingdomsX-1.16.14.1.jar</systemPath> <systemPath>${project.basedir}/libs/KingdomsX-1.16.14.1.jar</systemPath>
<scope>system</scope> <scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>su.nightexpress.coinsengine</groupId> <groupId>su.nightexpress.coinsengine</groupId>
<artifactId>CoinsEngine</artifactId> <artifactId>CoinsEngine</artifactId>
<version>2.1.1</version> <version>2.1.1</version>
<systemPath>${project.basedir}/libs/CoinsEngine-2.1.1.jar</systemPath> <systemPath>${project.basedir}/libs/CoinsEngine-2.1.1.jar</systemPath>
<scope>system</scope> <scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.qKing12.RoyaleEconomy</groupId> <groupId>me.qKing12.RoyaleEconomy</groupId>
<artifactId>RoyaleEconomy</artifactId> <artifactId>RoyaleEconomy</artifactId>
<version>1.4.4</version> <version>1.4.4</version>
<systemPath>${project.basedir}/libs/RoyaleEconomyAPI.jar</systemPath> <systemPath>${project.basedir}/libs/RoyaleEconomyAPI.jar</systemPath>
<scope>system</scope> <scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.MilkBowl</groupId> <groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId> <artifactId>VaultAPI</artifactId>
<version>1.7</version> <version>1.7</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.black_ixx</groupId> <groupId>org.black_ixx</groupId>
<artifactId>playerpoints</artifactId> <artifactId>playerpoints</artifactId>
<version>3.2.6</version> <version>3.2.6</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.TechsCode</groupId> <groupId>me.TechsCode</groupId>
<artifactId>UltraEconomyAPI</artifactId> <artifactId>UltraEconomyAPI</artifactId>
<version>2.6.4</version> <version>2.6.4</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>de.rapha149.signgui</groupId>--> <groupId>com.artillexstudios</groupId>
<!-- <artifactId>signgui</artifactId>--> <artifactId>AxShulkers</artifactId>
<!-- <version>2.3.2</version>--> <version>1.5.6</version>
<!-- <scope>compile</scope>--> <scope>provided</scope>
<!-- </dependency>--> </dependency>
<dependency> </dependencies>
<groupId>com.artillexstudios</groupId>
<artifactId>AxShulkers</artifactId>
<version>1.5.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project> </project>

View File

@ -11,7 +11,6 @@ import com.artillexstudios.axtrade.utils.SoundUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import revxrsal.commands.annotation.DefaultFor; import revxrsal.commands.annotation.DefaultFor;
import revxrsal.commands.annotation.Optional; import revxrsal.commands.annotation.Optional;
@ -29,6 +28,7 @@ import static com.artillexstudios.axtrade.AxTrade.HOOKS;
import static com.artillexstudios.axtrade.AxTrade.LANG; import static com.artillexstudios.axtrade.AxTrade.LANG;
import static com.artillexstudios.axtrade.AxTrade.MESSAGEUTILS; import static com.artillexstudios.axtrade.AxTrade.MESSAGEUTILS;
@CommandPermission(value = "axtrade.trade")
public class Commands implements OrphanCommand { public class Commands implements OrphanCommand {
public void help(@NotNull CommandSender sender) { public void help(@NotNull CommandSender sender) {
@ -79,7 +79,7 @@ public class Commands implements OrphanCommand {
} }
@Subcommand("reload") @Subcommand("reload")
@CommandPermission(value = "axtrade.admin", defaultAccess = PermissionDefault.OP) @CommandPermission(value = "axtrade.admin")
public void reload(@NotNull CommandSender sender) { public void reload(@NotNull CommandSender sender) {
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#00FFDD[AxTrade] &#AAFFDDReloading configuration...")); Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#00FFDD[AxTrade] &#AAFFDDReloading configuration..."));
if (!CONFIG.reload()) { if (!CONFIG.reload()) {
@ -118,8 +118,12 @@ public class Commands implements OrphanCommand {
} }
@Subcommand("force") @Subcommand("force")
@CommandPermission(value = "axtrade.admin", defaultAccess = PermissionDefault.OP) @CommandPermission(value = "axtrade.admin")
public void force(@NotNull Player sender, Player other) { public void force(@NotNull Player sender, Player other) {
if (sender.equals(other)) {
MESSAGEUTILS.sendLang(sender, "request.cant-trade-self");
return;
}
Trades.addTrade(sender, other); Trades.addTrade(sender, other);
} }

View File

@ -9,11 +9,14 @@ import org.jetbrains.annotations.NotNull;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import static com.artillexstudios.axtrade.AxTrade.CONFIG;
public class PlayerInteractEntityListener implements Listener { public class PlayerInteractEntityListener implements Listener {
private final WeakHashMap<Player, Long> cd = new WeakHashMap<>(); private final WeakHashMap<Player, Long> cd = new WeakHashMap<>();
@EventHandler (ignoreCancelled = true) @EventHandler (ignoreCancelled = true)
public void onClick(@NotNull PlayerInteractEntityEvent event) { public void onClick(@NotNull PlayerInteractEntityEvent event) {
if (!CONFIG.getBoolean("shift-click-send-request", true)) return;
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (cd.containsKey(player) && System.currentTimeMillis() - cd.get(player) < 100L) return; if (cd.containsKey(player) && System.currentTimeMillis() - cd.get(player) < 100L) return;

View File

@ -20,6 +20,9 @@ trade-request-expire-seconds: 60
# set to -1 to disable # set to -1 to disable
trade-max-distance: 10 trade-max-distance: 10
# should shift + right clicking on another player send them a trade request?
shift-click-send-request: true
number-formatting: number-formatting:
# modes: # modes:
# 0 - formatted (customizable, look at the formatted part) # 0 - formatted (customizable, look at the formatted part)
@ -48,4 +51,4 @@ blacklisted-items:
name-contains: "Banned item's name" name-contains: "Banned item's name"
# do not change this # do not change this
version: 1 version: 2

View File

@ -44,8 +44,8 @@ request:
sent-sender: "&#CCFFEEYou have successfully sent a trade request to &#00FFDD%player%&#CCFFEE!" sent-sender: "&#CCFFEEYou have successfully sent a trade request to &#00FFDD%player%&#CCFFEE!"
sent-receiver: | sent-receiver: |
&#CCFFEEYou have received a trade request from &#00FFDD%player%&#CCFFEE! &#CCFFEEYou have received a trade request from &#00FFDD%player%&#CCFFEE!
&#00FF00<click:run_command:'/trade accept %player%'>/trade accept %player%</click> &#00FF00/trade accept %player%
&#FF0000<click:run_command:'/trade deny %player%'>/trade deny %player%</click> &#FF0000/trade deny %player%
no-request: "&#CCFFEEYou don't have an active trade request from &#00FFDD%player%&#CCFFEE!" no-request: "&#CCFFEEYou don't have an active trade request from &#00FFDD%player%&#CCFFEE!"
deny-sender: "&#CCFFEEYou trade request was denied by &#00FFDD%player%&#CCFFEE!" deny-sender: "&#CCFFEEYou trade request was denied by &#00FFDD%player%&#CCFFEE!"
deny-receiver: "&#CCFFEEYou have successfully denied &#00FFDD%player%&#CCFFEE's trade request!" deny-receiver: "&#CCFFEEYou have successfully denied &#00FFDD%player%&#CCFFEE's trade request!"

View File

@ -4,6 +4,12 @@ main: com.artillexstudios.axtrade.AxTrade
api-version: '1.18' api-version: '1.18'
folia-supported: true folia-supported: true
permissions:
axtrade.admin:
default: op
axtrade.trade:
default: true
softdepend: softdepend:
- AxQuestBoard - AxQuestBoard
- CoinsEngine - CoinsEngine