Crimes were commited today.

PrimarySkillType was a mess... SkillTools is not much better though.
This commit is contained in:
nossr50
2019-07-04 04:41:08 -07:00
parent 8b39224cbc
commit 084b5edf1f
66 changed files with 1143 additions and 984 deletions

View File

@@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import org.bukkit.Material;
import org.bukkit.entity.Item;
@@ -73,7 +74,7 @@ public final class ShareHandler {
*/
public boolean handleItemShare(Item drop, McMMOPlayer mcMMOPlayer) {
ItemStack itemStack = drop.getItemStack();
ItemShareType dropType = ItemShareType.getShareType(itemStack);
ItemShareType dropType = getShareType(itemStack);
if (dropType == null) {
return false;
@@ -157,6 +158,22 @@ public final class ShareHandler {
}
}
public ItemShareType getShareType(ItemStack itemStack) {
if (ItemUtils.isMobDrop(itemStack)) {
return ItemShareType.LOOT;
} else if (ItemUtils.isMiningDrop(itemStack)) {
return ItemShareType.MINING;
} else if (ItemUtils.isHerbalismDrop(itemStack)) {
return ItemShareType.HERBALISM;
} else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
return ItemShareType.WOODCUTTING;
} else if (pluginRef.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(itemStack.getType()) != null) {
return ItemShareType.MISC;
}
return null;
}
private int getItemWeight(Material material) {
if (pluginRef.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(material) == null)
return 5;