Skip to content

Commit

Permalink
Version 0.14.6
Browse files Browse the repository at this point in the history
Fix buffed wool drops having extra NBT data
  • Loading branch information
bermudalocket committed Jan 6, 2019
1 parent 1ad349f commit 1675b2a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>nu.nerd</groupId>
<artifactId>KitchenSink</artifactId>
<name>KitchenSink</name>
<version>0.14.5</version>
<version>0.14.6</version>
<packaging>jar</packaging>
<description>A plugin for miscellaneous functionality that hasn't found a home elsewhere.</description>
<url>https://github.com/NerdNu/KitchenSink</url>
Expand Down
89 changes: 73 additions & 16 deletions src/nu/nerd/kitchensink/KitchenSinkListener.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
package nu.nerd.kitchensink;

import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;

import me.lucko.luckperms.LuckPerms;
import me.lucko.luckperms.api.LuckPermsApi;
import me.lucko.luckperms.api.Node;
import org.bukkit.Art;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
Expand Down Expand Up @@ -87,17 +79,23 @@
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.Wool;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.util.BlockIterator;

import me.lucko.luckperms.LuckPerms;
import me.lucko.luckperms.api.LuckPermsApi;
import me.lucko.luckperms.api.Node;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;

class KitchenSinkListener implements Listener {

Expand Down Expand Up @@ -644,7 +642,66 @@ public void onPlayerShearEntity(PlayerShearEntityEvent event) {
// Minecraft drops 1 - 3 wool. Mutiply by BUFF_SHEAR_DROPS, minus
// the drops dropped by the event.
int count = (1 + (int) (3 * Math.random())) * (plugin.config.BUFF_SHEAR_DROPS - 1);
l.getWorld().dropItemNaturally(l, new ItemStack(new Wool(entity.getColor()).getItemType(), count));

// this isn't working for some reason
//l.getWorld().dropItemNaturally(l, new ItemStack(new Wool(entity.getColor()).getItemType(), count));

Material wool;
switch (entity.getColor()) {
case BLACK:
wool = Material.BLACK_WOOL;
break;
case BLUE:
wool = Material.BLUE_WOOL;
break;
case BROWN:
wool = Material.BROWN_WOOL;
break;
case CYAN:
wool = Material.CYAN_WOOL;
break;
case GRAY:
wool = Material.GRAY_WOOL;
break;
case GREEN:
wool = Material.GREEN_WOOL;
break;
case LIGHT_BLUE:
wool = Material.LIGHT_BLUE_WOOL;
break;
case LIGHT_GRAY:
wool = Material.LIGHT_GRAY_WOOL;
break;
case LIME:
wool = Material.LIME_WOOL;
break;
case MAGENTA:
wool = Material.MAGENTA_WOOL;
break;
case ORANGE:
wool = Material.ORANGE_WOOL;
break;
case PINK:
wool = Material.PINK_WOOL;
break;
case PURPLE:
wool = Material.PURPLE_WOOL;
break;
case RED:
wool = Material.RED_WOOL;
break;
case WHITE:
wool = Material.WHITE_WOOL;
break;
case YELLOW:
wool = Material.YELLOW_WOOL;
break;
default:
wool = Material.WHITE_WOOL;
break;
}
l.getWorld().dropItemNaturally(l, new ItemStack(wool, count));

}
}

Expand Down

0 comments on commit 1675b2a

Please sign in to comment.