mirror of
https://github.com/PretzelJohn/VillagerTradeLimiter.git
synced 2024-12-03 23:53:51 +01:00
Version 1.5.8:
* Added config option to disable VTL (leaving vanilla trading) in certain worlds
This commit is contained in:
parent
65a8bdf267
commit
ccaefbbac7
98
dependency-reduced-pom.xml
Normal file
98
dependency-reduced-pom.xml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.pretzel.dev</groupId>
|
||||||
|
<artifactId>VillagerTradeLimiter</artifactId>
|
||||||
|
<version>1.5.8</version>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>shade</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>de.tr7zw.changeme.nbtapi</pattern>
|
||||||
|
<shadedPattern>com.pretzel.dev.villagertradelimiter.nms</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigotmc-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>codemc-repo</id>
|
||||||
|
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.29</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
<groupId>com.google.protobuf</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.xerial</groupId>
|
||||||
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
|
<version>3.36.0.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.pretzel.dev</groupId>
|
<groupId>com.pretzel.dev</groupId>
|
||||||
<artifactId>VillagerTradeLimiter</artifactId>
|
<artifactId>VillagerTradeLimiter</artifactId>
|
||||||
<version>1.5.7</version>
|
<version>1.5.8</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
@ -3,6 +3,7 @@ package com.pretzel.dev.villagertradelimiter.listeners;
|
|||||||
import com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter;
|
import com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter;
|
||||||
import com.pretzel.dev.villagertradelimiter.data.Cooldown;
|
import com.pretzel.dev.villagertradelimiter.data.Cooldown;
|
||||||
import com.pretzel.dev.villagertradelimiter.data.PlayerData;
|
import com.pretzel.dev.villagertradelimiter.data.PlayerData;
|
||||||
|
import com.pretzel.dev.villagertradelimiter.lib.Util;
|
||||||
import com.pretzel.dev.villagertradelimiter.settings.Settings;
|
import com.pretzel.dev.villagertradelimiter.settings.Settings;
|
||||||
import com.pretzel.dev.villagertradelimiter.wrappers.*;
|
import com.pretzel.dev.villagertradelimiter.wrappers.*;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -13,6 +14,7 @@ import org.bukkit.entity.Villager;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
@ -42,11 +44,15 @@ public class PlayerListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final Villager villager = (Villager)event.getRightClicked();
|
final Villager villager = (Villager)event.getRightClicked();
|
||||||
|
|
||||||
|
//Skips when the villager is in a disabled world
|
||||||
|
if(instance.getCfg().getStringList("DisableWorlds").contains(villager.getWorld().getName())) return;
|
||||||
|
|
||||||
//Skips when player is holding an ignored item
|
//Skips when player is holding an ignored item
|
||||||
Material heldItemType = player.getInventory().getItem(event.getHand()).getType();
|
ItemStack heldItem = player.getInventory().getItem(event.getHand());
|
||||||
|
if(heldItem != null) {
|
||||||
|
Material heldItemType = heldItem.getType();
|
||||||
for(String ignoredType : instance.getCfg().getStringList("IgnoreHeldItems")) {
|
for(String ignoredType : instance.getCfg().getStringList("IgnoreHeldItems")) {
|
||||||
if(heldItemType.equals(Material.matchMaterial(ignoredType))) {
|
if(heldItemType.equals(Material.matchMaterial(ignoredType))) return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(settings.shouldSkipNPC(event.getPlayer()) || settings.shouldSkipNPC(villager)) return; //Skips NPCs
|
if(settings.shouldSkipNPC(event.getPlayer()) || settings.shouldSkipNPC(villager)) return; //Skips NPCs
|
||||||
@ -90,6 +96,12 @@ public class PlayerListener implements Listener {
|
|||||||
* @param other The other player to view trades for, or the player that has just begun trading
|
* @param other The other player to view trades for, or the player that has just begun trading
|
||||||
*/
|
*/
|
||||||
public void see(final Villager villager, final Player player, final OfflinePlayer other) {
|
public void see(final Villager villager, final Player player, final OfflinePlayer other) {
|
||||||
|
//Skips when the villager is in a disabled world
|
||||||
|
if(instance.getCfg().getStringList("DisableWorlds").contains(villager.getWorld().getName())) {
|
||||||
|
Util.sendMsg(instance.getLang("see.noworld"), player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Wraps the villager and player into wrapper classes
|
//Wraps the villager and player into wrapper classes
|
||||||
final VillagerWrapper villagerWrapper = new VillagerWrapper(villager);
|
final VillagerWrapper villagerWrapper = new VillagerWrapper(villager);
|
||||||
final PlayerWrapper otherWrapper = new PlayerWrapper(other);
|
final PlayerWrapper otherWrapper = new PlayerWrapper(other);
|
||||||
|
@ -19,6 +19,11 @@ database:
|
|||||||
encoding: utf8
|
encoding: utf8
|
||||||
useSSL: false
|
useSSL: false
|
||||||
|
|
||||||
|
# Add world names for worlds that you want to have unaltered, vanilla villager trading in. Set to [] to disable this feature.
|
||||||
|
DisableWorlds:
|
||||||
|
- world_nether
|
||||||
|
- world_the_end
|
||||||
|
|
||||||
# Ignore Citizens NPCs, and/or Shopkeepers NPCs if true
|
# Ignore Citizens NPCs, and/or Shopkeepers NPCs if true
|
||||||
IgnoreCitizens: true
|
IgnoreCitizens: true
|
||||||
IgnoreShopkeepers: true
|
IgnoreShopkeepers: true
|
||||||
|
@ -16,4 +16,5 @@ see:
|
|||||||
success: "&aShowing the adjusted trades for &b{player}&a..."
|
success: "&aShowing the adjusted trades for &b{player}&a..."
|
||||||
noplayer: "&cInvalid player &b{player}&c! Please use a valid player's name."
|
noplayer: "&cInvalid player &b{player}&c! Please use a valid player's name."
|
||||||
novillager: "&cInvalid entity! Please look at the villager you want to check."
|
novillager: "&cInvalid entity! Please look at the villager you want to check."
|
||||||
|
noworld: "&cVTL is disabled in this world!"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: VillagerTradeLimiter
|
name: VillagerTradeLimiter
|
||||||
author: PretzelJohn
|
author: PretzelJohn
|
||||||
main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter
|
main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter
|
||||||
version: 1.5.7
|
version: 1.5.8
|
||||||
api-version: 1.14
|
api-version: 1.14
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user