forked from Upstream/VillagerTradeLimiter
Version 1.6.0:
* Added compatibility with ODailyQuests plugin * Fixed potential bug on 1.14 with equipment slot * Updated to NBT-API 2.11.1
This commit is contained in:
parent
f13fac70fc
commit
58d1b24ff0
@ -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.9</version>
|
<version>1.6.0</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
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.9</version>
|
<version>1.6.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
@ -12,6 +12,7 @@ import com.pretzel.dev.villagertradelimiter.lib.Util;
|
|||||||
import com.pretzel.dev.villagertradelimiter.listeners.PlayerListener;
|
import com.pretzel.dev.villagertradelimiter.listeners.PlayerListener;
|
||||||
import com.pretzel.dev.villagertradelimiter.settings.Lang;
|
import com.pretzel.dev.villagertradelimiter.settings.Lang;
|
||||||
import com.pretzel.dev.villagertradelimiter.settings.Settings;
|
import com.pretzel.dev.villagertradelimiter.settings.Settings;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
@ -48,7 +48,7 @@ public class PlayerListener implements Listener {
|
|||||||
if(instance.getCfg().getStringList("DisableWorlds").contains(villager.getWorld().getName())) return;
|
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
|
||||||
ItemStack heldItem = player.getInventory().getItem(event.getHand());
|
ItemStack heldItem = player.getInventory().getItem(event.getHand().ordinal());
|
||||||
if(heldItem != null) {
|
if(heldItem != null) {
|
||||||
Material heldItemType = heldItem.getType();
|
Material heldItemType = heldItem.getType();
|
||||||
for(String ignoredType : instance.getCfg().getStringList("IgnoreHeldItems")) {
|
for(String ignoredType : instance.getCfg().getStringList("IgnoreHeldItems")) {
|
||||||
@ -78,7 +78,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Cancel the original event, and open the adjusted trade view
|
//Cancel the original event, and open the adjusted trade view
|
||||||
event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
if(!instance.getPlayerData().containsKey(player.getUniqueId())) {
|
if(!instance.getPlayerData().containsKey(player.getUniqueId())) {
|
||||||
instance.getPlayerData().put(player.getUniqueId(), new PlayerData());
|
instance.getPlayerData().put(player.getUniqueId(), new PlayerData());
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.pretzel.dev.villagertradelimiter.wrappers;
|
|||||||
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
||||||
import de.tr7zw.changeme.nbtapi.NBTCompoundList;
|
import de.tr7zw.changeme.nbtapi.NBTCompoundList;
|
||||||
import de.tr7zw.changeme.nbtapi.NBTEntity;
|
import de.tr7zw.changeme.nbtapi.NBTEntity;
|
||||||
|
import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
@ -34,8 +35,8 @@ public class VillagerWrapper {
|
|||||||
final NBTCompound offers = entity.getCompound("Offers");
|
final NBTCompound offers = entity.getCompound("Offers");
|
||||||
if(offers == null) return recipes;
|
if(offers == null) return recipes;
|
||||||
final NBTCompoundList nbtRecipes = offers.getCompoundList("Recipes");
|
final NBTCompoundList nbtRecipes = offers.getCompoundList("Recipes");
|
||||||
for(NBTCompound nbtRecipe : nbtRecipes) {
|
for(ReadWriteNBT nbtRecipe : nbtRecipes) {
|
||||||
recipes.add(new RecipeWrapper(nbtRecipe));
|
recipes.add(new RecipeWrapper((NBTCompound)nbtRecipe));
|
||||||
}
|
}
|
||||||
return recipes;
|
return recipes;
|
||||||
}
|
}
|
||||||
@ -43,12 +44,12 @@ public class VillagerWrapper {
|
|||||||
/** @return A list of wrapped gossips for the villager */
|
/** @return A list of wrapped gossips for the villager */
|
||||||
private List<GossipWrapper> getGossips() {
|
private List<GossipWrapper> getGossips() {
|
||||||
final List<GossipWrapper> gossips = new ArrayList<>();
|
final List<GossipWrapper> gossips = new ArrayList<>();
|
||||||
if(!entity.hasKey("Gossips")) return gossips;
|
if(!entity.hasTag("Gossips")) return gossips;
|
||||||
|
|
||||||
//Add the gossips from the villager's NBT data into a list of wrapped gossips
|
//Add the gossips from the villager's NBT data into a list of wrapped gossips
|
||||||
final NBTCompoundList nbtGossips = entity.getCompoundList("Gossips");
|
final NBTCompoundList nbtGossips = entity.getCompoundList("Gossips");
|
||||||
for(NBTCompound nbtGossip : nbtGossips) {
|
for(ReadWriteNBT nbtGossip : nbtGossips) {
|
||||||
gossips.add(new GossipWrapper(nbtGossip));
|
gossips.add(new GossipWrapper((NBTCompound) nbtGossip));
|
||||||
}
|
}
|
||||||
return gossips;
|
return gossips;
|
||||||
}
|
}
|
||||||
|
@ -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.9
|
version: 1.6.0
|
||||||
api-version: 1.14
|
api-version: 1.14
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user