1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 17:53:00 +01:00

Compare commits

...

24 Commits

Author SHA1 Message Date
nossr50
46e285bf44 Merge branch 'configurable' of github.com:mcMMO-Dev/mcmmo into configurable 2020-03-18 17:09:05 -07:00
nossr50
9a72af12b3 Merge branch 'master' of github.com:mcMMO-Dev/mcmmo into configurable 2020-03-18 17:05:08 -07:00
nossr50
f8dbace9f0 add comment 2020-03-17 16:00:32 -07:00
nossr50
58174d3391 dev mode 2020-03-17 15:42:25 -07:00
nossr50
7865ad8934 2.1.123 2020-03-13 15:15:00 -07:00
nossr50
d525f754a7 Add nether gold ore 2020-03-11 17:53:36 -07:00
nossr50
fd1b1fe124 treat new vines as multi block plants 2020-03-11 17:52:35 -07:00
nossr50
de71c60d6b Weeping vines fix / twisted vines added 2020-03-11 17:47:00 -07:00
nossr50
5609f1cdde update changelog 2020-03-11 17:45:18 -07:00
Shane Freeder
1bd4454a6b Show correct minimum level in adept salvage message 2020-03-07 23:20:18 +00:00
nossr50
8f8dfcf556 Update ability black lists 2020-03-03 22:32:24 -08:00
nossr50
ce1051c364 2.1.122 2020-03-03 22:24:35 -08:00
nossr50
b9d05d8d67 Move roots to herbalism xp tables 2020-03-03 22:13:34 -08:00
nossr50
3aa9f385e5 Wart blocks are now treated like leaves 2020-03-03 22:09:57 -08:00
nossr50
ff8c94bf44 2.1.121 2020-03-03 18:14:56 -08:00
nossr50
51e80f40dd sigh 2020-03-03 17:57:51 -08:00
nossr50
a7d2c901df 2.1.120 2020-03-03 17:52:18 -08:00
nossr50
325cbcad9d 2.1.120 2020-03-03 17:52:02 -08:00
nossr50
2644de5ab4 2.1.119 - 1.16 Support 2020-03-03 17:19:46 -08:00
nossr50
3a81d94b32 1.16 support part 5 2020-03-03 17:14:57 -08:00
nossr50
89a990f0cb Another dupe fix + 1.16 support part 4 2020-03-03 16:37:13 -08:00
nossr50
d585b1c2f7 1.16 support part 3 2020-03-02 14:52:51 -08:00
nossr50
1101815f18 1.16 Support part 2 2020-02-28 16:44:37 -08:00
nossr50
efea1c5d33 1.16 Support part 1 2020-02-28 16:29:11 -08:00
18 changed files with 931 additions and 303 deletions

View File

@@ -203,6 +203,84 @@ Version 2.2.0
Added API method to check if a skill was being level capped Added API method to check if a skill was being level capped
Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill
Version 2.1.123
Added 'Nether_Gold_Ore' to Mining XP tables in experience.yml with a value of 1300
Adept Salvage message will now show the correct minimum level
'Weeping_Vines' renamed to 'Weeping_Vines_Plant' in experience.yml (no edits necessary)
'Twisted_Vines_Plant' added to Herbalism XP tables in experience.yml with a value of 10
Weeping_Vines_Plant and Twisted_Vines_Plant are now flagged as multi-block plants in Herbalism
Version 2.1.122
Changed the xp values for Nether_Wart_Block and Warped_Wart_Block from 20 to 1 for Woodcutting
Changed the xp values for Nether_Wart_Block and Warped_Wart_Block from 20 to 3 for Herbalism
mcMMO now treats Nether_Wart_Block and Warped_Wart_Block as leaves
Removed Crimson_Roots and Warped_Roots from Woodcutting XP tables in experience.yml
Added Crimson_Roots and Warped_Roots to Herbalism XP tables in experience.yml with a value of 6 XP
Fixed some start up bugs for salvage/repair
You can either edit experience.yml yourself or delete it to regenerate a new one to get the new changes
Version 2.1.121
Fixed a netherite related bug that prevented mcMMO from functioning correctly
Version 2.1.120
Fixed a bug involving the new netherite equipment
Version 2.1.119
1.16 Support
Fixed another dupe bug
Fixed a bug that can cause blast mining to give out more rewards than intended
Blast Mining rewards are now randomized but still influenced by your blast mining rank
mcMMO is now aware of turtle shell and treats it appropriately
mcMMO is now aware of chainmail armor and treats it appropriately
Calculations which change depend on the quality of your tool or armor has had netherrack support coded in
All excavation drops that can drop from soul_sand now also drop from soul_soil (edited treasures.yml)
Added netherite armor/weapons/tools to repair.vanilla.yml
Added netherite armor/weapons/tools to salvage.vanilla.yml
Added 'Bamboo_Sapling' to bonus drops for Herbalism in experience.yml
Added 'Ancient_Debris' with a value of 7777 to Mining experience tables in experience.yml
Added 'Basalt' with a value of 40 to Mining experience tables in experience.yml
Added 'Crimson_Fungus' with a value of 50 to Herbalism experience tables in experience.yml
Added 'Warped_Fungus' with a value of 50 to Herbalism experience tables in experience.yml
Added 'Warped_Nylium' with a value of 5 to Mining experience tables in experience.yml
Added 'Crimson_Nylium' with a value of 5 to Mining experience tables in experience.yml
Added 'Crimson_Stem' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Crimson_Roots' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Warped_Stem' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Warped_Roots' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Ancient_Debris' with a value of 200 to Smelting experience tables in experience.yml
Added 'Nether_Sprouts' with a value of 10 to Herbalism experience tables in experience.yml
Added 'Shroomlight' with a value of 100 to Woodcutting experience tables in experience.yml
Added 'Soul_Soil' with a value of 50 to Excavation experience tables in experience.yml
Added 'Nether_Wart_Block' with a value of 20 to Woodcutting experience tables in experience.yml
Added 'Nether_Wart_Block' with a value of 20 to Herbalism experience tables in experience.yml
Added 'Warped_Wart_Block' with a value of 20 to Woodcutting experience tables in experience.yml
Added 'Warped_Wart_Block' with a value of 20 to Herbalism experience tables in experience.yml
Added 'Weeping_Vines' with a value of 10 to Herbalism experience tables in experience.yml
Added 'Ancient_Debris' to bonus drops for Mining in config.yml
Added 'Netherite_Scrap' to bonus drops for Mining in config.yml
Added 'Crimson_Fungus' to bonus drops for Herbalism in config.yml
Added 'Warped_Fungus' to bonus drops for Herbalism in config.yml
Added 'Warped_Nylium' to bonus drops for Mining in config.yml
Added 'Crimson_Nylium' to bonus drops for Mining in config.yml
Added 'Crimson_Stem' to bonus drops for Woodcutting in config.yml
Added 'Warped_Stem' to bonus drops for Woodcutting in config.yml
Added 'Shroomlight' to bonus drops for Woodcutting in config.yml
NOTES: You will likely need to update repair.vanilla.yml, salvage.vanilla.yml and treasures.yml
You can just delete those config files to regenerate them fresh which is much faster if you don't have any custom settings in those files
Here are the default configuration files if you wish to compare them to your own servers settings while updating your configs.
https://paste.gg/p/anonymous/bf8ba1a24c8c4f188da5f8b8ebfc2b35 (Keep scrolling)
Netherrack is repaired using netherrack scraps for now, wait for 2.2 for a better version of repair.
Netherrack salvages into netherrack scraps for now, wait for 2.2 for a better version of salvage.
Repairing chainmail/etc will be tackled in 2.2 so don't expect that in this version
Version 2.1.118 Version 2.1.118
Fixed another dupe bug Fixed another dupe bug
Blast Mining no longer reduces debris from explosions due to some issues with the Bukkit API Blast Mining no longer reduces debris from explosions due to some issues with the Bukkit API

View File

@@ -54,13 +54,40 @@ public class NBTToolsCommand extends BaseCommand {
player.sendMessage(ChatColor.GRAY + "NBT Analysis completed!"); player.sendMessage(ChatColor.GRAY + "NBT Analysis completed!");
} }
@Subcommand("tags add") @Subcommand("tags set")
public void onAddTags(Player player) { public void onAddTags(Player player, String[] args) {
if(args.length == 0) {
player.sendMessage("No arguments provided!");
} else if(args.length == 1) {
player.sendMessage("Not enough arguments provided!");
} else {
player.sendMessage("Modifying NBT on item in hand...");
String targetTag = args[0];
//Check for the tag
}
} }
@Subcommand("tags remove") @Subcommand("tags remove")
public void onRemoveTags(Player player) { public void onRemoveTags(Player player, String[] args) {
if(args.length == 0) {
player.sendMessage("No arguments provided!");
} else if(args.length == 1) {
player.sendMessage("Not enough arguments provided!");
} else {
player.sendMessage("Modifying NBT on item in hand...");
String targetTag = args[0];
//Check for the tag
}
}
@Subcommand("tags clear")
public void onClearTags(Player player) {
//Clear all NBT tags that fall under "tag" on the item
player.sendMessage("Clearing NBT on item...");
} }
} }

View File

@@ -81,8 +81,7 @@ public class MiningCommand extends SkillCommand {
} }
if (canBlast) { if (canBlast) {
messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(pluginRef.getRankTools().getHighestRank(SubSkillType.MINING_BLAST_MINING)), pluginRef.getLocaleManager().getString("Mining.Blast.Effect", oreBonus, bonusTNTDrops))); messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(pluginRef.getRankTools().getHighestRank(SubSkillType.MINING_BLAST_MINING)), pluginRef.getLocaleManager().getString("SuperAbility.BlastMining.Effect", oreBonus, bonusTNTDrops)));
//messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
} }
if (canDemoExpert) { if (canDemoExpert) {

View File

@@ -2,6 +2,7 @@ package com.gmail.nossr50.core;
import org.bukkit.Material; import org.bukkit.Material;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
@@ -24,7 +25,39 @@ public class MaterialMapStore {
private HashSet<String> foodItemWhiteList; private HashSet<String> foodItemWhiteList;
private HashSet<String> glassBlocks; private HashSet<String> glassBlocks;
public MaterialMapStore() { private HashSet<String> netheriteArmor;
private HashSet<String> netheriteTools;
private HashSet<String> woodTools;
private HashSet<String> stoneTools;
private HashSet<String> leatherArmor;
private HashSet<String> ironArmor;
private HashSet<String> ironTools;
private HashSet<String> stringTools;
private HashSet<String> goldArmor;
private HashSet<String> goldTools;
private HashSet<String> chainmailArmor;
private HashSet<String> diamondArmor;
private HashSet<String> diamondTools;
private HashSet<String> armors;
private HashSet<String> swords;
private HashSet<String> axes;
private HashSet<String> hoes;
private HashSet<String> shovels;
private HashSet<String> pickAxes;
private HashSet<String> tridents;
private HashSet<String> bows;
private HashSet<String> tools;
private HashSet<String> enchantables;
private HashSet<String> ores;
private HashMap<String, Integer> tierValue;
public MaterialMapStore()
{
abilityBlackList = new HashSet<>(); abilityBlackList = new HashSet<>();
toolBlackList = new HashSet<>(); toolBlackList = new HashSet<>();
mossyWhiteList = new HashSet<>(); mossyWhiteList = new HashSet<>();
@@ -36,7 +69,38 @@ public class MaterialMapStore {
foodItemWhiteList = new HashSet<>(); foodItemWhiteList = new HashSet<>();
glassBlocks = new HashSet<>(); glassBlocks = new HashSet<>();
fillHardcodedHashSets(); leatherArmor = new HashSet<>();
ironArmor = new HashSet<>();
chainmailArmor = new HashSet<>();
goldArmor = new HashSet<>();
diamondArmor = new HashSet<>();
netheriteArmor = new HashSet<>();
armors = new HashSet<>();
woodTools = new HashSet<>();
stoneTools = new HashSet<>();
ironTools = new HashSet<>();
goldTools = new HashSet<>();
diamondTools = new HashSet<>();
netheriteTools = new HashSet<>();
bows = new HashSet<>();
stringTools = new HashSet<>();
tools = new HashSet<>();
swords = new HashSet<>();
axes = new HashSet<>();
pickAxes = new HashSet<>();
shovels = new HashSet<>();
hoes = new HashSet<>();
tridents = new HashSet<>();
enchantables = new HashSet<>();
ores = new HashSet<>();
tierValue = new HashMap<>();
fillVanillaMaterialRegisters();
} }
public boolean isMultiBlockPlant(Material material) public boolean isMultiBlockPlant(Material material)
@@ -72,7 +136,8 @@ public class MaterialMapStore {
return canMakeShroomyWhiteList.contains(material.getKey().getKey()); return canMakeShroomyWhiteList.contains(material.getKey().getKey());
} }
private void fillHardcodedHashSets() { private void fillVanillaMaterialRegisters()
{
fillAbilityBlackList(); fillAbilityBlackList();
fillToolBlackList(); fillToolBlackList();
fillMossyWhiteList(); fillMossyWhiteList();
@@ -83,6 +148,320 @@ public class MaterialMapStore {
fillMultiBlockEntitiesList(); fillMultiBlockEntitiesList();
fillFoodWhiteList(); fillFoodWhiteList();
fillGlassBlockWhiteList(); fillGlassBlockWhiteList();
fillArmors();
fillTools();
fillEnchantables();
fillOres();
fillTierMap();
}
private void fillTierMap() {
for(String id : leatherArmor) {
tierValue.put(id, 1);
}
for(String id : ironArmor) {
tierValue.put(id, 2);
}
for(String id : goldArmor) {
tierValue.put(id, 3);
}
for(String id : chainmailArmor) {
tierValue.put(id, 3);
}
for(String id : diamondArmor) {
tierValue.put(id, 6);
}
for(String id : netheriteArmor) {
tierValue.put(id, 12);
}
}
private void fillOres() {
ores.add("coal_ore");
ores.add("diamond_ore");
ores.add("nether_quartz_ore");
ores.add("quartz_ore"); //Pre 1.13
ores.add("gold_ore");
ores.add("iron_ore");
ores.add("lapis_ore");
ores.add("redstone_ore");
ores.add("emerald_ore");
ores.add("ancient_debris");
}
private void fillArmors() {
fillLeatherArmorWhiteList();
fillIronArmorWhiteList();
fillChainmailWhiteList();
fillGoldArmorWhiteList();
fillDiamondArmorWhiteList();
fillnetheriteArmorWhiteList();
//Add all armors to armors hashset
armors.addAll(leatherArmor);
armors.addAll(ironArmor);
armors.addAll(chainmailArmor);
armors.addAll(goldArmor);
armors.addAll(diamondArmor);
armors.addAll(netheriteArmor);
armors.add("turtle_shell");
}
private void fillEnchantables() {
enchantables.addAll(armors);
enchantables.addAll(swords);
enchantables.addAll(axes);
enchantables.addAll(hoes);
enchantables.addAll(pickAxes);
enchantables.addAll(tridents);
enchantables.addAll(bows);
enchantables.add("shears");
enchantables.add("fishing_rod");
enchantables.add("carrot_on_a_stick");
enchantables.add("enchanted_book");
enchantables.add("flint_and_steel");
enchantables.add("turtle_shell");
}
private void fillTools() {
fillWoodToolsWhiteList();
fillStoneToolsWhiteList();
fillIronToolsWhiteList();
fillGoldToolsWhiteList();
fillDiamondToolsWhiteList();
fillnetheriteToolsWhiteList();
fillSwords();
fillAxes();
fillPickAxes();
fillHoes();
fillShovels();
fillTridents();
fillStringTools();
fillBows();
//Tools collection
tools.addAll(woodTools);
tools.addAll(stoneTools);
tools.addAll(ironTools);
tools.addAll(goldTools);
tools.addAll(diamondTools);
tools.addAll(netheriteTools);
tools.addAll(tridents);
tools.addAll(stringTools);
tools.addAll(bows);
}
private void fillBows() {
bows.add("bow");
}
private void fillStringTools() {
stringTools.add("bow");
stringTools.add("fishing_rod");
stringTools.add("carrot_on_a_stick");
}
private void fillTridents() {
tridents.add("trident");
}
private void fillSwords() {
swords.add("wood_sword");
swords.add("wooden_sword");
swords.add("stone_sword");
swords.add("iron_sword");
swords.add("gold_sword");
swords.add("golden_sword");
swords.add("diamond_sword");
swords.add("netherite_sword");
}
private void fillAxes() {
axes.add("wood_axe");
axes.add("wooden_axe");
axes.add("stone_axe");
axes.add("iron_axe");
axes.add("gold_axe");
axes.add("golden_axe");
axes.add("diamond_axe");
axes.add("netherite_axe");
}
private void fillPickAxes() {
pickAxes.add("wood_pickaxe");
pickAxes.add("wooden_pickaxe");
pickAxes.add("stone_pickaxe");
pickAxes.add("iron_pickaxe");
pickAxes.add("gold_pickaxe");
pickAxes.add("golden_pickaxe");
pickAxes.add("diamond_pickaxe");
pickAxes.add("netherite_pickaxe");
}
private void fillHoes() {
hoes.add("wood_hoe");
hoes.add("wooden_hoe");
hoes.add("stone_hoe");
hoes.add("iron_hoe");
hoes.add("gold_hoe");
hoes.add("golden_hoe");
hoes.add("diamond_hoe");
hoes.add("netherite_hoe");
}
private void fillShovels() {
shovels.add("wood_shovel");
shovels.add("wooden_shovel");
shovels.add("stone_shovel");
shovels.add("iron_shovel");
shovels.add("gold_shovel");
shovels.add("golden_shovel");
shovels.add("diamond_shovel");
shovels.add("netherite_shovel");
}
private void fillLeatherArmorWhiteList() {
leatherArmor.add("leather_helmet");
leatherArmor.add("leather_chestplate");
leatherArmor.add("leather_leggings");
leatherArmor.add("leather_boots");
}
private void fillIronArmorWhiteList() {
ironArmor.add("iron_helmet");
ironArmor.add("iron_chestplate");
ironArmor.add("iron_leggings");
ironArmor.add("iron_boots");
}
private void fillChainmailWhiteList() {
chainmailArmor.add("chainmail_helmet");
chainmailArmor.add("chainmail_chestplate");
chainmailArmor.add("chainmail_leggings");
chainmailArmor.add("chainmail_boots");
}
private void fillGoldArmorWhiteList() {
goldArmor.add("gold_helmet");
goldArmor.add("gold_chestplate");
goldArmor.add("gold_leggings");
goldArmor.add("gold_boots");
//Gold became Golden post 1.13
goldArmor.add("golden_helmet");
goldArmor.add("golden_chestplate");
goldArmor.add("golden_leggings");
goldArmor.add("golden_boots");
}
private void fillDiamondArmorWhiteList() {
diamondArmor.add("diamond_helmet");
diamondArmor.add("diamond_chestplate");
diamondArmor.add("diamond_leggings");
diamondArmor.add("diamond_boots");
}
private void fillnetheriteArmorWhiteList() {
netheriteArmor.add("netherite_helmet");
netheriteArmor.add("netherite_chestplate");
netheriteArmor.add("netherite_leggings");
netheriteArmor.add("netherite_boots");
}
private void fillWoodToolsWhiteList() {
woodTools.add("wood_sword");
woodTools.add("wood_axe");
woodTools.add("wood_hoe");
woodTools.add("wood_pickaxe");
woodTools.add("wood_shovel");
//Wood became wooden post 1.13
woodTools.add("wooden_sword");
woodTools.add("wooden_axe");
woodTools.add("wooden_hoe");
woodTools.add("wooden_pickaxe");
woodTools.add("wooden_shovel");
}
private void fillStoneToolsWhiteList() {
stoneTools.add("stone_sword");
stoneTools.add("stone_axe");
stoneTools.add("stone_hoe");
stoneTools.add("stone_pickaxe");
stoneTools.add("stone_shovel");
}
private void fillIronToolsWhiteList() {
ironTools.add("iron_sword");
ironTools.add("iron_axe");
ironTools.add("iron_hoe");
ironTools.add("iron_pickaxe");
ironTools.add("iron_shovel");
//Used for repair, remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
//TODO: Remove in 2.2
ironTools.add("bucket");
ironTools.add("flint_and_steel");
ironTools.add("shears");
}
private void fillGoldToolsWhiteList() {
goldTools.add("gold_sword");
goldTools.add("gold_axe");
goldTools.add("gold_hoe");
goldTools.add("gold_pickaxe");
goldTools.add("gold_shovel");
//Gold became golden post 1.13
goldTools.add("golden_sword");
goldTools.add("golden_axe");
goldTools.add("golden_hoe");
goldTools.add("golden_pickaxe");
goldTools.add("golden_shovel");
}
private void fillDiamondToolsWhiteList() {
diamondTools.add("diamond_sword");
diamondTools.add("diamond_axe");
diamondTools.add("diamond_hoe");
diamondTools.add("diamond_pickaxe");
diamondTools.add("diamond_shovel");
}
private void fillnetheriteToolsWhiteList() {
netheriteTools.add("netherite_sword");
netheriteTools.add("netherite_axe");
netheriteTools.add("netherite_hoe");
netheriteTools.add("netherite_pickaxe");
netheriteTools.add("netherite_shovel");
} }
private void fillGlassBlockWhiteList() { private void fillGlassBlockWhiteList() {
@@ -161,6 +540,200 @@ public class MaterialMapStore {
foodItemWhiteList.add("tropical_fish"); foodItemWhiteList.add("tropical_fish");
} }
/**
* Checks if a Material is used for Armor
* @param material target material
* @return true if it is used for armor
*/
public boolean isArmor(Material material) {
return isArmor(material.getKey().getKey());
}
/**
* Checks if the id provided is used as armor
* @param id target item id
* @return true if the item id matches armor
*/
public boolean isArmor(String id) {
return armors.contains(id);
}
public boolean isTool(Material material) {
return isTool(material.getKey().getKey());
}
public boolean isTool(String id) {
return tools.contains(id);
}
public boolean isEnchantable(Material material) {
return isEnchantable(material.getKey().getKey());
}
public boolean isEnchantable(String id) {
return enchantables.contains(id);
}
public boolean isOre(Material material) {
return isOre(material.getKey().getKey());
}
public boolean isOre(String id) {
return ores.contains(id);
}
public boolean isBow(Material material) {
return isBow(material.getKey().getKey());
}
public boolean isBow(String id) {
return bows.contains(id);
}
public boolean isLeatherArmor(Material material) {
return isLeatherArmor(material.getKey().getKey());
}
public boolean isLeatherArmor(String id) {
return leatherArmor.contains(id);
}
public boolean isIronArmor(Material material) {
return isIronArmor(material.getKey().getKey());
}
public boolean isIronArmor(String id) {
return ironArmor.contains(id);
}
public boolean isGoldArmor(Material material) {
return isGoldArmor(material.getKey().getKey());
}
public boolean isGoldArmor(String id) {
return goldArmor.contains(id);
}
public boolean isDiamondArmor(Material material) {
return isDiamondArmor(material.getKey().getKey());
}
public boolean isDiamondArmor(String id) {
return diamondArmor.contains(id);
}
public boolean isChainmailArmor(Material material) {
return isChainmailArmor(material.getKey().getKey());
}
public boolean isChainmailArmor(String id) {
return chainmailArmor.contains(id);
}
public boolean isNetheriteArmor(Material material) {
return isNetheriteArmor(material.getKey().getKey());
}
public boolean isNetheriteArmor(String id) {
return netheriteArmor.contains(id);
}
public boolean isWoodTool(Material material) {
return isWoodTool(material.getKey().getKey());
}
public boolean isWoodTool(String id) {
return woodTools.contains(id);
}
public boolean isStoneTool(Material material) {
return isStoneTool(material.getKey().getKey());
}
public boolean isStoneTool(String id) {
return stoneTools.contains(id);
}
public boolean isIronTool(Material material) {
return isIronTool(material.getKey().getKey());
}
public boolean isIronTool(String id) {
return ironTools.contains(id);
}
public boolean isGoldTool(Material material) {
return isGoldTool(material.getKey().getKey());
}
public boolean isGoldTool(String id) {
return goldTools.contains(id);
}
public boolean isDiamondTool(Material material) {
return isDiamondTool(material.getKey().getKey());
}
public boolean isDiamondTool(String id) {
return diamondTools.contains(id);
}
public boolean isSword(Material material) {
return isSword(material.getKey().getKey());
}
public boolean isSword(String id) {
return swords.contains(id);
}
public boolean isAxe(Material material) {
return isAxe(material.getKey().getKey());
}
public boolean isAxe(String id) {
return axes.contains(id);
}
public boolean isPickAxe(Material material) {
return isPickAxe(material.getKey().getKey());
}
public boolean isPickAxe(String id) {
return pickAxes.contains(id);
}
public boolean isShovel(Material material) {
return isShovel(material.getKey().getKey());
}
public boolean isShovel(String id) {
return shovels.contains(id);
}
public boolean isHoe(Material material) {
return isHoe(material.getKey().getKey());
}
public boolean isHoe(String id) {
return hoes.contains(id);
}
public boolean isNetheriteTool(Material material) {
return isNetheriteTool(material.getKey().getKey());
}
public boolean isNetheriteTool(String id) {
return netheriteTools.contains(id);
}
public boolean isStringTool(Material material) {
return isStringTool(material.getKey().getKey());
}
public boolean isStringTool(String id) {
return stringTools.contains(id);
}
public boolean isGlass(Material material) { public boolean isGlass(Material material) {
return glassBlocks.contains(material.getKey().getKey()); return glassBlocks.contains(material.getKey().getKey());
} }
@@ -181,6 +754,8 @@ public class MaterialMapStore {
multiBlockPlant.add("large_fern"); multiBlockPlant.add("large_fern");
multiBlockPlant.add("tall_grass"); multiBlockPlant.add("tall_grass");
multiBlockPlant.add("bamboo"); multiBlockPlant.add("bamboo");
multiBlockPlant.add("weeping_vines_plant");
multiBlockPlant.add("twisted_vines_plant");
} }
private void fillShroomyWhiteList() { private void fillShroomyWhiteList() {
@@ -209,6 +784,8 @@ public class MaterialMapStore {
leavesWhiteList.add("dark_oak_leaves"); leavesWhiteList.add("dark_oak_leaves");
leavesWhiteList.add("jungle_leaves"); leavesWhiteList.add("jungle_leaves");
leavesWhiteList.add("spruce_leaves"); leavesWhiteList.add("spruce_leaves");
leavesWhiteList.add("nether_wart_block");
leavesWhiteList.add("warped_wart_block");
} }
private void fillMossyWhiteList() { private void fillMossyWhiteList() {
@@ -219,7 +796,18 @@ public class MaterialMapStore {
mossyWhiteList.add("cobblestone_wall"); mossyWhiteList.add("cobblestone_wall");
} }
private void fillAbilityBlackList() { private void fillAbilityBlackList()
{
abilityBlackList.add("warped_fence_gate");
abilityBlackList.add("crimson_fence_gate");
abilityBlackList.add("warped_pressure_plate");
abilityBlackList.add("crimson_pressure_plate");
abilityBlackList.add("warped_button");
abilityBlackList.add("crimson_button");
abilityBlackList.add("warped_door");
abilityBlackList.add("crimson_door");
abilityBlackList.add("warped_trapdoor");
abilityBlackList.add("crimson_trapdoor");
abilityBlackList.add("black_bed"); abilityBlackList.add("black_bed");
abilityBlackList.add("blue_bed"); abilityBlackList.add("blue_bed");
abilityBlackList.add("brown_bed"); abilityBlackList.add("brown_bed");
@@ -473,6 +1061,14 @@ public class MaterialMapStore {
toolBlackList.add("stonecutter"); toolBlackList.add("stonecutter");
} }
public int getTier(Material material) {
return getTier(material.getKey().getKey());
}
public int getTier(String id) {
return tierValue.getOrDefault(id, 1); //1 for unknown items
}
private void addToHashSet(String string, HashSet<String> stringHashSet) private void addToHashSet(String string, HashSet<String> stringHashSet)
{ {
stringHashSet.add(string.toLowerCase(Locale.ENGLISH)); stringHashSet.add(string.toLowerCase(Locale.ENGLISH));

View File

@@ -10,6 +10,7 @@ public enum ItemMaterialCategory {
IRON, IRON,
GOLD, GOLD,
DIAMOND, DIAMOND,
NETHER,
OTHER; OTHER;
public Material getDefaultMaterial() { public Material getDefaultMaterial() {
@@ -35,6 +36,12 @@ public enum ItemMaterialCategory {
case DIAMOND: case DIAMOND:
return Material.DIAMOND; return Material.DIAMOND;
case NETHER:
if(Material.getMaterial("netherite_scrap") != null)
return Material.getMaterial("netherite_scrap");
else
return Material.GOLD_INGOT;
case OTHER: case OTHER:
default: default:
return null; return null;

View File

@@ -83,6 +83,7 @@ public class EntityListener implements Listener {
Entity projectile = event.getProjectile(); Entity projectile = event.getProjectile();
//Should be noted that there are API changes regarding Arrow from 1.13.2 to current versions of the game
if (!(projectile instanceof Arrow)) { if (!(projectile instanceof Arrow)) {
return; return;
} }

View File

@@ -120,9 +120,9 @@ public class MiningManager extends SkillManager {
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class); TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
//SkillUtils.sendSkillMessage(player, SuperAbilityType.BLAST_miningBehaviour.getAbilityPlayer(player)); //SkillUtils.sendSkillMessage(player, SuperAbilityType.BLAST_MINING.getAbilityPlayer(player));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "miningBehaviour.Blast.Boom"); pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom");
//player.sendMessage(pluginRef.getLocaleManager().getString("miningBehaviour.Blast.Boom")); //player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
tnt.setMetadata(MetadataConstants.TNT_TRACKING_METAKEY, mcMMOPlayer.getPlayerMetadata()); tnt.setMetadata(MetadataConstants.TNT_TRACKING_METAKEY, mcMMOPlayer.getPlayerMetadata());
tnt.setFuseTicks(0); tnt.setFuseTicks(0);
@@ -130,25 +130,49 @@ public class MiningManager extends SkillManager {
mcMMOPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis()); mcMMOPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
mcMMOPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false); mcMMOPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
new AbilityCooldownTask(pluginRef, mcMMOPlayer, SuperAbilityType.BLAST_MINING) new AbilityCooldownTask(pluginRef, mcMMOPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(pluginRef, pluginRef.getSkillTools().getSuperAbilityCooldown(SuperAbilityType.BLAST_MINING) * pluginRef.getMiscTools().TICK_CONVERSION_FACTOR);
.runTaskLater(pluginRef, pluginRef.getSkillTools().getSuperAbilityCooldown(SuperAbilityType.BLAST_MINING)
* pluginRef.getMiscTools().TICK_CONVERSION_FACTOR);
} }
/** /**
* Handler for explosion drops and XP gain. * Handler for explosion drops and XP gain.
* *
* @param yield The % of blocks to drop * @param yield The % of blocks to drop
* @param event The {@link EntityExplodeEvent} * @param event The {@link EntityExplodeEvent}
*/ */
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
public void blastMiningDropProcessing(float yield, EntityExplodeEvent event) { public void blastMiningDropProcessing(float yield, EntityExplodeEvent event) {
List<BlockState> ores = new ArrayList<>(); //Strip out only stuff that gives mining XP
List<Block> newYieldList = new ArrayList<>();
List<BlockState> ores = new ArrayList<BlockState>();
List<Block> notOres = new ArrayList<>();
for (Block targetBlock : event.blockList()) { for (Block targetBlock : event.blockList()) {
//Containers usually have 0 XP unless someone edited their config in a very strange way //Containers usually have 0 XP unless someone edited their config in a very strange way
if (pluginRef.getDynamicSettingsManager().getExperienceManager().getMiningXp(targetBlock.getType()) == 0 || targetBlock instanceof Container || pluginRef.getPlaceStore().isTrue(targetBlock)) { if (pluginRef.getDynamicSettingsManager().getExperienceManager().getMiningXp(targetBlock.getType()) == 0 || targetBlock instanceof Container || pluginRef.getPlaceStore().isTrue(targetBlock)) {
newYieldList.add(targetBlock); notOres.add(targetBlock);
} else { } else {
ores.add(targetBlock.getState()); ores.add(targetBlock.getState());
} }
@@ -156,28 +180,28 @@ public class MiningManager extends SkillManager {
int xp = 0; int xp = 0;
float oreBonus = (float) (getOreBonus() / 100); // float oreBonus = (float) (getOreBonus() / 100);
//float debrisReduction = (float) (getDebrisReduction() / 100); //TODO: Pretty sure something is fucked with debrisReduction stuff
// float debrisReduction = (float) (getDebrisReduction() / 100);
int dropMultiplier = getDropMultiplier(); int dropMultiplier = getDropMultiplier();
//float debrisYield = yield - debrisReduction; // float debrisYield = yield - debrisReduction;
for (BlockState blockState : ores) { for (BlockState blockState : ores) {
if (pluginRef.getMiscTools().getRandom().nextFloat() < (newYieldList.size() + oreBonus)) { if (pluginRef.getMiscTools().getRandom().nextInt(ores.size()) >= (ores.size() / 2)) {
xp += miningBehaviour.getBlockXp(blockState); xp += pluginRef.getDynamicSettingsManager().getExperienceManager().getMiningXp(blockState.getType());
pluginRef.getMiscTools().dropItem(pluginRef.getMiscTools().getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped pluginRef.getMiscTools().dropItem(pluginRef.getMiscTools().getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
for (int i = 1; i < dropMultiplier; i++) { for (int i = 1; i < dropMultiplier; i++) {
miningBehaviour.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items if(pluginRef.getMiscTools().getRandom().nextInt(100) >= 75)
miningBehaviour.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items
} }
} }
} }
event.blockList().clear(); //Replace the event blocklist with the newYield list
event.blockList().addAll(newYieldList); event.setYield(0F);
applyXpGain(xp, XPGainReason.PVE); applyXpGain(xp, XPGainReason.PVE);
} }

View File

@@ -89,7 +89,9 @@ public class SwordsManager extends SkillManager {
} }
public int getToolTier(ItemStack itemStack) { public int getToolTier(ItemStack itemStack) {
if (pluginRef.getItemTools().isDiamondTool(itemStack)) if(pluginRef.getItemTools().isNetheriteTool(itemStack))
return 5;
else if (pluginRef.getItemTools().isDiamondTool(itemStack))
return 4; return 4;
else if (pluginRef.getItemTools().isIronTool(itemStack) || pluginRef.getItemTools().isGoldTool(itemStack)) else if (pluginRef.getItemTools().isIronTool(itemStack) || pluginRef.getItemTools().isGoldTool(itemStack))
return 3; return 3;

View File

@@ -119,7 +119,7 @@ public final class BlockTools {
* @return true if the block is an ore, false otherwise * @return true if the block is an ore, false otherwise
*/ */
public boolean isOre(BlockState blockState) { public boolean isOre(BlockState blockState) {
return MaterialUtils.isOre(blockState.getType()); return pluginRef.getMaterialMapStore().isOre(blockState.getType());
} }
/** /**

View File

@@ -103,16 +103,7 @@ public final class ItemTools {
* @return true if the item is a bow, false otherwise * @return true if the item is a bow, false otherwise
*/ */
public boolean isBow(ItemStack item) { public boolean isBow(ItemStack item) {
Material type = item.getType(); return pluginRef.getMaterialMapStore().isBow(item.getType().getKey().getKey());
switch (type) {
case BOW:
return true;
default:
return false;
//return mcMMO.getModManager().isCustomBow(type);
}
} }
public boolean hasItemInEitherHand(Player player, Material material) { public boolean hasItemInEitherHand(Player player, Material material) {
@@ -126,20 +117,7 @@ public final class ItemTools {
* @return true if the item is a sword, false otherwise * @return true if the item is a sword, false otherwise
*/ */
public boolean isSword(ItemStack item) { public boolean isSword(ItemStack item) {
Material type = item.getType(); return pluginRef.getMaterialMapStore().isSword(item.getType().getKey().getKey());
switch (type) {
case DIAMOND_SWORD:
case GOLDEN_SWORD:
case IRON_SWORD:
case STONE_SWORD:
case WOODEN_SWORD:
return true;
default:
return false;
//return mcMMO.getModManager().isCustomSword(type);
}
} }
/** /**
@@ -149,20 +127,7 @@ public final class ItemTools {
* @return true if the item is a hoe, false otherwise * @return true if the item is a hoe, false otherwise
*/ */
public boolean isHoe(ItemStack item) { public boolean isHoe(ItemStack item) {
Material type = item.getType(); return pluginRef.getMaterialMapStore().isHoe(item.getType().getKey().getKey());
switch (type) {
case DIAMOND_HOE:
case GOLDEN_HOE:
case IRON_HOE:
case STONE_HOE:
case WOODEN_HOE:
return true;
default:
return false;
//return mcMMO.getModManager().isCustomHoe(type);
}
} }
/** /**
@@ -172,20 +137,7 @@ public final class ItemTools {
* @return true if the item is a shovel, false otherwise * @return true if the item is a shovel, false otherwise
*/ */
public boolean isShovel(ItemStack item) { public boolean isShovel(ItemStack item) {
Material type = item.getType(); return pluginRef.getMaterialMapStore().isShovel(item.getType().getKey().getKey());
switch (type) {
case DIAMOND_SHOVEL:
case GOLDEN_SHOVEL:
case IRON_SHOVEL:
case STONE_SHOVEL:
case WOODEN_SHOVEL:
return true;
default:
return false;
//return mcMMO.getModManager().isCustomShovel(type);
}
} }
/** /**
@@ -195,20 +147,7 @@ public final class ItemTools {
* @return true if the item is an axe, false otherwise * @return true if the item is an axe, false otherwise
*/ */
public boolean isAxe(ItemStack item) { public boolean isAxe(ItemStack item) {
Material type = item.getType(); return pluginRef.getMaterialMapStore().isAxe(item.getType().getKey().getKey());
switch (type) {
case DIAMOND_AXE:
case GOLDEN_AXE:
case IRON_AXE:
case STONE_AXE:
case WOODEN_AXE:
return true;
default:
return false;
//return mcMMO.getModManager().isCustomAxe(type);
}
} }
/** /**
@@ -218,20 +157,7 @@ public final class ItemTools {
* @return true if the item is a pickaxe, false otherwise * @return true if the item is a pickaxe, false otherwise
*/ */
public boolean isPickaxe(ItemStack item) { public boolean isPickaxe(ItemStack item) {
Material type = item.getType(); return pluginRef.getMaterialMapStore().isPickAxe(item.getType().getKey().getKey());
switch (type) {
case DIAMOND_PICKAXE:
case GOLDEN_PICKAXE:
case IRON_PICKAXE:
case STONE_PICKAXE:
case WOODEN_PICKAXE:
return true;
default:
return false;
//return mcMMO.getModManager().isCustomPickaxe(type);
}
} }
/** /**
@@ -357,7 +283,7 @@ public final class ItemTools {
* @return true if the item is armor, false otherwise * @return true if the item is armor, false otherwise
*/ */
public boolean isMinecraftArmor(ItemStack item) { public boolean isMinecraftArmor(ItemStack item) {
return isLeatherArmor(item) || isGoldArmor(item) || isIronArmor(item) || isDiamondArmor(item) || isChainmailArmor(item); return pluginRef.getMaterialMapStore().isArmor(item.getType());
} }
/** /**
@@ -367,16 +293,7 @@ public final class ItemTools {
* @return true if the item is leather armor, false otherwise * @return true if the item is leather armor, false otherwise
*/ */
public boolean isLeatherArmor(ItemStack item) { public boolean isLeatherArmor(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isLeatherArmor(item.getType());
case LEATHER_BOOTS:
case LEATHER_CHESTPLATE:
case LEATHER_HELMET:
case LEATHER_LEGGINGS:
return true;
default:
return false;
}
} }
/** /**
@@ -386,16 +303,7 @@ public final class ItemTools {
* @return true if the item is gold armor, false otherwise * @return true if the item is gold armor, false otherwise
*/ */
public boolean isGoldArmor(ItemStack item) { public boolean isGoldArmor(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isGoldArmor(item.getType().getKey().getKey());
case GOLDEN_BOOTS:
case GOLDEN_CHESTPLATE:
case GOLDEN_HELMET:
case GOLDEN_LEGGINGS:
return true;
default:
return false;
}
} }
/** /**
@@ -405,16 +313,7 @@ public final class ItemTools {
* @return true if the item is iron armor, false otherwise * @return true if the item is iron armor, false otherwise
*/ */
public boolean isIronArmor(ItemStack item) { public boolean isIronArmor(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isIronArmor(item.getType().getKey().getKey());
case IRON_BOOTS:
case IRON_CHESTPLATE:
case IRON_HELMET:
case IRON_LEGGINGS:
return true;
default:
return false;
}
} }
/** /**
@@ -424,16 +323,15 @@ public final class ItemTools {
* @return true if the item is diamond armor, false otherwise * @return true if the item is diamond armor, false otherwise
*/ */
public boolean isDiamondArmor(ItemStack item) { public boolean isDiamondArmor(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isDiamondArmor(item.getType().getKey().getKey());
case DIAMOND_BOOTS: }
case DIAMOND_CHESTPLATE:
case DIAMOND_HELMET:
case DIAMOND_LEGGINGS:
return true;
default: public boolean isNetheriteArmor(ItemStack itemStack) {
return false; return pluginRef.getMaterialMapStore().isNetheriteArmor(itemStack.getType().getKey().getKey());
} }
public boolean isNetheriteTool(ItemStack itemStack) {
return pluginRef.getMaterialMapStore().isNetheriteTool(itemStack.getType().getKey().getKey());
} }
/** /**
@@ -443,16 +341,7 @@ public final class ItemTools {
* @return true if the item is chainmail armor, false otherwise * @return true if the item is chainmail armor, false otherwise
*/ */
public boolean isChainmailArmor(ItemStack item) { public boolean isChainmailArmor(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isChainmailArmor(item.getType().getKey().getKey());
case CHAINMAIL_BOOTS:
case CHAINMAIL_CHESTPLATE:
case CHAINMAIL_HELMET:
case CHAINMAIL_LEGGINGS:
return true;
default:
return false;
}
} }
/** /**
@@ -462,7 +351,7 @@ public final class ItemTools {
* @return true if the item is a tool, false otherwise * @return true if the item is a tool, false otherwise
*/ */
public boolean isMinecraftTool(ItemStack item) { public boolean isMinecraftTool(ItemStack item) {
return isStoneTool(item) || isWoodTool(item) || isGoldTool(item) || isIronTool(item) || isDiamondTool(item) || isStringTool(item) || item.getType() == Material.TRIDENT; return pluginRef.getMaterialMapStore().isTool(item.getType().getKey().getKey());
} }
/** /**
@@ -472,17 +361,7 @@ public final class ItemTools {
* @return true if the item is a stone tool, false otherwise * @return true if the item is a stone tool, false otherwise
*/ */
public boolean isStoneTool(ItemStack item) { public boolean isStoneTool(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isStoneTool(item.getType().getKey().getKey());
case STONE_AXE:
case STONE_HOE:
case STONE_PICKAXE:
case STONE_SHOVEL:
case STONE_SWORD:
return true;
default:
return false;
}
} }
/** /**
@@ -492,17 +371,7 @@ public final class ItemTools {
* @return true if the item is a wooden tool, false otherwise * @return true if the item is a wooden tool, false otherwise
*/ */
public boolean isWoodTool(ItemStack item) { public boolean isWoodTool(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isWoodTool(item.getType().getKey().getKey());
case WOODEN_AXE:
case WOODEN_HOE:
case WOODEN_PICKAXE:
case WOODEN_SHOVEL:
case WOODEN_SWORD:
return true;
default:
return false;
}
} }
/** /**
@@ -532,15 +401,7 @@ public final class ItemTools {
* @return true if the item is a string tool, false otherwise * @return true if the item is a string tool, false otherwise
*/ */
public boolean isStringTool(ItemStack item) { public boolean isStringTool(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isStringTool(item.getType().getKey().getKey());
case BOW:
case CARROT_ON_A_STICK:
case FISHING_ROD:
return true;
default:
return false;
}
} }
/** /**
@@ -550,17 +411,7 @@ public final class ItemTools {
* @return true if the item is a stone tool, false otherwise * @return true if the item is a stone tool, false otherwise
*/ */
public boolean isGoldTool(ItemStack item) { public boolean isGoldTool(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isGoldTool(item.getType().getKey().getKey());
case GOLDEN_AXE:
case GOLDEN_HOE:
case GOLDEN_PICKAXE:
case GOLDEN_SHOVEL:
case GOLDEN_SWORD:
return true;
default:
return false;
}
} }
/** /**
@@ -570,20 +421,7 @@ public final class ItemTools {
* @return true if the item is an iron tool, false otherwise * @return true if the item is an iron tool, false otherwise
*/ */
public boolean isIronTool(ItemStack item) { public boolean isIronTool(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isIronTool(item.getType().getKey().getKey());
case BUCKET:
case FLINT_AND_STEEL:
case IRON_AXE:
case IRON_HOE:
case IRON_PICKAXE:
case IRON_SHOVEL:
case IRON_SWORD:
case SHEARS:
return true;
default:
return false;
}
} }
/** /**
@@ -593,17 +431,7 @@ public final class ItemTools {
* @return true if the item is a diamond tool, false otherwise * @return true if the item is a diamond tool, false otherwise
*/ */
public boolean isDiamondTool(ItemStack item) { public boolean isDiamondTool(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isDiamondTool(item.getType().getKey().getKey());
case DIAMOND_AXE:
case DIAMOND_HOE:
case DIAMOND_PICKAXE:
case DIAMOND_SHOVEL:
case DIAMOND_SWORD:
return true;
default:
return false;
}
} }
/** /**
@@ -613,22 +441,11 @@ public final class ItemTools {
* @return true if the item is enchantable, false otherwise * @return true if the item is enchantable, false otherwise
*/ */
public boolean isEnchantable(ItemStack item) { public boolean isEnchantable(ItemStack item) {
switch (item.getType()) { return pluginRef.getMaterialMapStore().isEnchantable(item.getType().getKey().getKey());
case ENCHANTED_BOOK:
case SHEARS:
case FISHING_ROD:
case CARROT_ON_A_STICK:
case FLINT_AND_STEEL:
case TRIDENT:
return true;
default:
return isArmor(item) || isSword(item) || isAxe(item) || isShovel(item) || isPickaxe(item) || isBow(item);
}
} }
public boolean isSmeltable(ItemStack item) { public boolean isSmeltable(ItemStack item) {
return item != null && item.getType().isBlock() && MaterialUtils.isOre(item.getType()); return item != null && item.getType().isBlock() && pluginRef.getMaterialMapStore().isOre(item.getType());
} }
public boolean isSmelted(ItemStack item) { public boolean isSmelted(ItemStack item) {
@@ -639,7 +456,7 @@ public final class ItemTools {
for (Recipe recipe : pluginRef.getServer().getRecipesFor(item)) { for (Recipe recipe : pluginRef.getServer().getRecipesFor(item)) {
if (recipe instanceof FurnaceRecipe if (recipe instanceof FurnaceRecipe
&& ((FurnaceRecipe) recipe).getInput().getType().isBlock() && ((FurnaceRecipe) recipe).getInput().getType().isBlock()
&& MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getType())) { && pluginRef.getMaterialMapStore().isOre(((FurnaceRecipe) recipe).getInput().getType())) {
return true; return true;
} }
} }

View File

@@ -1,26 +0,0 @@
package com.gmail.nossr50.util;
import org.bukkit.Material;
public final class MaterialUtils {
private MaterialUtils() {
}
protected static boolean isOre(Material data) {
switch (data) {
case COAL_ORE:
case DIAMOND_ORE:
case NETHER_QUARTZ_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
case EMERALD_ORE:
return true;
default:
return false;
/*default:
return mcMMO.getModManager().isCustomOre(data);*/
}
}
}

View File

@@ -133,6 +133,29 @@ public final class MiscTools {
return location.getWorld().dropItemNaturally(location, itemStack); return location.getWorld().dropItemNaturally(location, itemStack);
} }
/**
* Drop an item at a given location.
*
* @param location The location to drop the item at
* @param itemStack The item to drop
* @return Dropped Item entity or null if invalid or cancelled
*/
public Item dropItem(Location location, ItemStack itemStack, int count) {
if (itemStack.getType() == Material.AIR) {
return null;
}
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
pluginRef.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return null;
}
return location.getWorld().dropItem(location, itemStack);
}
/** /**
* Drop items at a given location. * Drop items at a given location.
* *

View File

@@ -476,31 +476,7 @@ public final class CombatTools {
* @return the armor quality of a specific Item Stack * @return the armor quality of a specific Item Stack
*/ */
private int getArmorQuality(ItemStack itemStack) { private int getArmorQuality(ItemStack itemStack) {
int quality = 0; return pluginRef.getMaterialMapStore().getTier(itemStack.getType().getKey().getKey());
switch(itemStack.getType()) {
case LEATHER_HELMET:
case LEATHER_BOOTS:
case LEATHER_CHESTPLATE:
case LEATHER_LEGGINGS:
return 1;
case IRON_HELMET:
case IRON_BOOTS:
case IRON_CHESTPLATE:
case IRON_LEGGINGS:
return 2;
case GOLDEN_HELMET:
case GOLDEN_BOOTS:
case GOLDEN_CHESTPLATE:
case GOLDEN_LEGGINGS:
return 3;
case DIAMOND_HELMET:
case DIAMOND_BOOTS:
case DIAMOND_CHESTPLATE:
case DIAMOND_LEGGINGS:
return 6;
default:
return 1;
}
} }
/** /**

View File

@@ -421,6 +421,9 @@ Skills:
### ###
Bonus_Drops: Bonus_Drops:
Herbalism: Herbalism:
Bamboo_Sapling: true
Crimson_Fungus: true
Warped_Fungus: true
Chorus_Fruit: true Chorus_Fruit: true
Chorus_Plant: true Chorus_Plant: true
Beetroots: true Beetroots: true
@@ -458,6 +461,10 @@ Bonus_Drops:
Peony: true Peony: true
Lily_Of_The_Valley: true Lily_Of_The_Valley: true
Mining: Mining:
Warped_Nylium: true
Crimson_Nylium: true
Ancient_Debris: true
Netherite_Scrap: true
Andesite: true Andesite: true
Diorite: true Diorite: true
Granite: true Granite: true
@@ -486,6 +493,11 @@ Bonus_Drops:
Stone: true Stone: true
Cobblestone: true Cobblestone: true
Woodcutting: Woodcutting:
Shroomlight: true
Crimson_Stem: true
Warped_Stem: true
Crimson_Roots: true
Warped_Roots: true
Acacia_Wood: true Acacia_Wood: true
Acacia_Log: true Acacia_Log: true
Birch_Wood: true Birch_Wood: true

View File

@@ -246,7 +246,13 @@ Experience_Values:
Snow: 20 Snow: 20
Snow_Block: 40 Snow_Block: 40
Soul_Sand: 40 Soul_Sand: 40
Soul_Soil: 40
Woodcutting: Woodcutting:
Nether_Wart_Block: 1
Warped_Wart_Block: 1
Shroomlight: 100
Crimson_Stem: 35
Warped_Stem: 35
Oak_Log: 70 Oak_Log: 70
Spruce_Log: 80 Spruce_Log: 80
Birch_Log: 90 Birch_Log: 90
@@ -275,6 +281,13 @@ Experience_Values:
Brown_Mushroom_Block: 70 Brown_Mushroom_Block: 70
Mushroom_Stem: 80 Mushroom_Stem: 80
Herbalism: Herbalism:
Crimson_Roots: 6
Warped_Roots: 6
Nether_Wart_Block: 3
Warped_Wart_Block: 3
Nether_Sprouts: 10
Crimson_Fungus: 50
Warped_Fungus: 50
Bee_Nest: 200 Bee_Nest: 200
Sweet_Berry_Bush: 50 Sweet_Berry_Bush: 50
Seagrass: 10 Seagrass: 10
@@ -343,6 +356,8 @@ Experience_Values:
Tall_Grass: 50 Tall_Grass: 50
Large_Fern: 50 Large_Fern: 50
Vine: 10 Vine: 10
Weeping_Vines_Plant: 10
Twisting_Vines_Plant: 10
Lily_Pad: 100 Lily_Pad: 100
White_Tulip: 150 White_Tulip: 150
Dandelion: 100 Dandelion: 100
@@ -351,7 +366,11 @@ Experience_Values:
Lily_Of_The_Valley: 150 Lily_Of_The_Valley: 150
Wither_Rose: 500 Wither_Rose: 500
Mining: Mining:
Warped_Nylium: 5
Crimson_Nylium: 5
Ancient_Debris: 7777
Magma_Block: 30 Magma_Block: 30
Basalt: 40
Tube_Coral_Block: 75 Tube_Coral_Block: 75
Brain_Coral_Block: 80 Brain_Coral_Block: 80
Bubble_Coral_Block: 70 Bubble_Coral_Block: 70
@@ -365,6 +384,7 @@ Experience_Values:
End_Stone: 15 End_Stone: 15
Glowstone: 15 Glowstone: 15
Gold_Ore: 1300 Gold_Ore: 1300
Nether_Gold_Ore: 1300
Terracotta: 30 Terracotta: 30
Iron_Ore: 900 Iron_Ore: 900
Lapis_Ore: 800 Lapis_Ore: 800
@@ -420,6 +440,7 @@ Experience_Values:
String: 1.8 String: 1.8
Other: 1.5 Other: 1.5
Smelting: Smelting:
Ancient_Debris: 200
Coal_Ore: 10 Coal_Ore: 10
Diamond_Ore: 75 Diamond_Ore: 75
Emerald_Ore: 100 Emerald_Ore: 100

View File

@@ -569,7 +569,7 @@ Excavation:
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.05
Drop_Level: 75 Drop_Level: 75
Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil]
GUNPOWDER: GUNPOWDER:
Amount: 1 Amount: 1
XP: 30 XP: 30
@@ -659,19 +659,19 @@ Excavation:
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.05
Drop_Level: 25 Drop_Level: 25
Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil]
MUSIC_DISC_CAT: MUSIC_DISC_CAT:
Amount: 1 Amount: 1
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.05
Drop_Level: 25 Drop_Level: 25
Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil]
DIAMOND: DIAMOND:
Amount: 1 Amount: 1
XP: 1000 XP: 1000
Drop_Chance: 0.13 Drop_Chance: 0.13
Drop_Level: 35 Drop_Level: 35
Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil]
COCOA_BEANS: COCOA_BEANS:
Amount: 1 Amount: 1
XP: 100 XP: 100
@@ -683,13 +683,13 @@ Excavation:
XP: 100 XP: 100
Drop_Chance: 0.5 Drop_Chance: 0.5
Drop_Level: 85 Drop_Level: 85
Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand] Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand, Soul_Soil]
NAME_TAG: NAME_TAG:
Amount: 1 Amount: 1
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.05
Drop_Level: 25 Drop_Level: 25
Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil]
# #
# Settings for Hylian Luck # Settings for Hylian Luck
# If you are in retro mode, Drop_Level is multiplied by 10. # If you are in retro mode, Drop_Level is multiplied by 10.

View File

@@ -11,7 +11,7 @@
## This defaults to OTHER. ## This defaults to OTHER.
# #
# ItemMaterialCategory: This is the type of the material of the item to be repaired, this is only important for permissions. # ItemMaterialCategory: This is the type of the material of the item to be repaired, this is only important for permissions.
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER ## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, NETHER, and OTHER
## This defaults to OTHER. ## This defaults to OTHER.
# #
# RepairMaterial: This is the material name of the item used to repair this repairable. # RepairMaterial: This is the material name of the item used to repair this repairable.
@@ -181,6 +181,39 @@ Repairables:
DIAMOND_BOOTS: DIAMOND_BOOTS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 6 XpMultiplier: 6
#
# Diamond repairables
###
# Tools
NETHERITE_SWORD:
MinimumLevel: 0
XpMultiplier: .6
NETHERITE_SHOVEL:
MinimumLevel: 0
XpMultiplier: .4
NETHERITE_PICKAXE:
MinimumLevel: 0
XpMultiplier: 1.1
NETHERITE_AXE:
MinimumLevel: 0
XpMultiplier: 1.1
NETHERITE_HOE:
MinimumLevel: 0
XpMultiplier: .75
# Armor
NETHERITE_HELMET:
MinimumLevel: 0
XpMultiplier: 7
NETHERITE_CHESTPLATE:
MinimumLevel: 0
XpMultiplier: 7
NETHERITE_LEGGINGS:
MinimumLevel: 0
XpMultiplier: 7
NETHERITE_BOOTS:
MinimumLevel: 0
XpMultiplier: 7
# #
# Leather repairables # Leather repairables
### ###

View File

@@ -10,8 +10,8 @@
## Valid values are ARMOR, TOOL, and OTHER. ## Valid values are ARMOR, TOOL, and OTHER.
## This defaults to OTHER. ## This defaults to OTHER.
# #
# ItemMaterialCategory: This is the type of the material of the item to be salvaged, this is only important for permissions. # MaterialType: This is the type of the material of the item to be salvaged, this is only important for permissions.
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER ## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, NETHER, and OTHER
## This defaults to OTHER. ## This defaults to OTHER.
# #
# SalvageMaterial: This is the material name of the item used to salvage this item. # SalvageMaterial: This is the material name of the item used to salvage this item.
@@ -218,6 +218,44 @@ Salvageables:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 6 XpMultiplier: 6
MaximumQuantity: 4 MaximumQuantity: 4
NETHERITE_SWORD:
MinimumLevel: 50
XpMultiplier: .5
MaximumQuantity: 2
NETHERITE_SHOVEL:
MinimumLevel: 50
XpMultiplier: .3
MaximumQuantity: 1
NETHERITE_PICKAXE:
MinimumLevel: 50
XpMultiplier: 1
MaximumQuantity: 3
NETHERITE_AXE:
MinimumLevel: 50
XpMultiplier: 1
MaximumQuantity: 3
NETHERITE_HOE:
MinimumLevel: 50
XpMultiplier: .5
MaximumQuantity: 2
# Armor
NETHERITE_HELMET:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 5
NETHERITE_CHESTPLATE:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 8
NETHERITE_LEGGINGS:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 7
NETHERITE_BOOTS:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 4
# #
# Leather salvageables # Leather salvageables
### ###