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:
PretzelJohn 2023-02-18 11:09:23 -05:00
parent f13fac70fc
commit 58d1b24ff0
6 changed files with 12 additions and 10 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pretzel.dev</groupId>
<artifactId>VillagerTradeLimiter</artifactId>
<version>1.5.9</version>
<version>1.6.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pretzel.dev</groupId>
<artifactId>VillagerTradeLimiter</artifactId>
<version>1.5.9</version>
<version>1.6.0</version>
<properties>
<java.version>1.8</java.version>

View File

@ -12,6 +12,7 @@ import com.pretzel.dev.villagertradelimiter.lib.Util;
import com.pretzel.dev.villagertradelimiter.listeners.PlayerListener;
import com.pretzel.dev.villagertradelimiter.settings.Lang;
import com.pretzel.dev.villagertradelimiter.settings.Settings;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

View File

@ -48,7 +48,7 @@ public class PlayerListener implements Listener {
if(instance.getCfg().getStringList("DisableWorlds").contains(villager.getWorld().getName())) return;
//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) {
Material heldItemType = heldItem.getType();
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
event.setCancelled(true);
//event.setCancelled(true);
if(!instance.getPlayerData().containsKey(player.getUniqueId())) {
instance.getPlayerData().put(player.getUniqueId(), new PlayerData());
}

View File

@ -3,6 +3,7 @@ package com.pretzel.dev.villagertradelimiter.wrappers;
import de.tr7zw.changeme.nbtapi.NBTCompound;
import de.tr7zw.changeme.nbtapi.NBTCompoundList;
import de.tr7zw.changeme.nbtapi.NBTEntity;
import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT;
import org.bukkit.entity.Villager;
import org.bukkit.inventory.ItemStack;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -34,8 +35,8 @@ public class VillagerWrapper {
final NBTCompound offers = entity.getCompound("Offers");
if(offers == null) return recipes;
final NBTCompoundList nbtRecipes = offers.getCompoundList("Recipes");
for(NBTCompound nbtRecipe : nbtRecipes) {
recipes.add(new RecipeWrapper(nbtRecipe));
for(ReadWriteNBT nbtRecipe : nbtRecipes) {
recipes.add(new RecipeWrapper((NBTCompound)nbtRecipe));
}
return recipes;
}
@ -43,12 +44,12 @@ public class VillagerWrapper {
/** @return A list of wrapped gossips for the villager */
private List<GossipWrapper> getGossips() {
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
final NBTCompoundList nbtGossips = entity.getCompoundList("Gossips");
for(NBTCompound nbtGossip : nbtGossips) {
gossips.add(new GossipWrapper(nbtGossip));
for(ReadWriteNBT nbtGossip : nbtGossips) {
gossips.add(new GossipWrapper((NBTCompound) nbtGossip));
}
return gossips;
}

View File

@ -1,7 +1,7 @@
name: VillagerTradeLimiter
author: PretzelJohn
main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter
version: 1.5.9
version: 1.6.0
api-version: 1.14
commands: