mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Added a new Party item share category "Misc" which contains a list of configurable items.
This commit is contained in:
parent
3ffcaae122
commit
822e40bc1f
@ -15,6 +15,7 @@ Version 1.4.06-dev
|
|||||||
+ Added new API method to McMMOPlayerLevelUpEvent to set levels gained
|
+ Added new API method to McMMOPlayerLevelUpEvent to set levels gained
|
||||||
+ Added new permission node for /ptp; mcmmo.commands.ptp.send (enabled by default)
|
+ Added new permission node for /ptp; mcmmo.commands.ptp.send (enabled by default)
|
||||||
+ Added configurable cooldown and warmup times when using /ptp
|
+ Added configurable cooldown and warmup times when using /ptp
|
||||||
|
+ Added a new Party item share category "Misc" which contains a list of configurable items. (By default all tools and armor)
|
||||||
= Fixed bug where players were able to join the same party multiple times
|
= Fixed bug where players were able to join the same party multiple times
|
||||||
= Fixed displaying partial names when trying to use /ptp
|
= Fixed displaying partial names when trying to use /ptp
|
||||||
= Fixed wolves from Call of the Wild only having 8 health
|
= Fixed wolves from Call of the Wild only having 8 health
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.gmail.nossr50.config.party;
|
package com.gmail.nossr50.config.party;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
@ -30,6 +33,22 @@ public class ItemWeightConfig extends ConfigLoader {
|
|||||||
return itemWeight;
|
return itemWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashSet<Material> getMiscItems() {
|
||||||
|
HashSet<Material> miscItems = new HashSet<Material>();
|
||||||
|
|
||||||
|
List<String> itemList = config.getStringList("Party_Shareables.Misc_Items");
|
||||||
|
|
||||||
|
for (String item : itemList) {
|
||||||
|
String materialName = item.toUpperCase();
|
||||||
|
Material material = Material.getMaterial(materialName);
|
||||||
|
|
||||||
|
if (material != null) {
|
||||||
|
miscItems.add(material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return miscItems;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {}
|
protected void loadKeys() {}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ public class Party {
|
|||||||
private boolean shareMiningDrops = true;
|
private boolean shareMiningDrops = true;
|
||||||
private boolean shareHerbalismDrops = true;
|
private boolean shareHerbalismDrops = true;
|
||||||
private boolean shareWoodcuttingDrops = true;
|
private boolean shareWoodcuttingDrops = true;
|
||||||
|
private boolean shareMiscDrops = true;
|
||||||
|
|
||||||
public LinkedHashSet<String> getMembers() {
|
public LinkedHashSet<String> getMembers() {
|
||||||
return members;
|
return members;
|
||||||
@ -74,6 +75,10 @@ public class Party {
|
|||||||
return shareWoodcuttingDrops;
|
return shareWoodcuttingDrops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean sharingMiscDrops() {
|
||||||
|
return shareMiscDrops;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getItemShareCategories() {
|
public List<String> getItemShareCategories() {
|
||||||
List<String> shareCategories = new ArrayList<String>();
|
List<String> shareCategories = new ArrayList<String>();
|
||||||
|
|
||||||
@ -94,6 +99,10 @@ public class Party {
|
|||||||
shareCategories.add("Woodcutting");
|
shareCategories.add("Woodcutting");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sharingMiscDrops()) {
|
||||||
|
shareCategories.add("Misc");
|
||||||
|
}
|
||||||
|
|
||||||
return shareCategories;
|
return shareCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,9 @@ public final class ShareHandler {
|
|||||||
else if (ItemUtils.isWoodcuttingDrop(itemStack) && !party.sharingWoodcuttingDrops()) {
|
else if (ItemUtils.isWoodcuttingDrop(itemStack) && !party.sharingWoodcuttingDrops()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (ItemUtils.isMiscDrop(itemStack) && !party.sharingMiscDrops()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (party.getItemShareMode()) {
|
switch (party.getItemShareMode()) {
|
||||||
case EQUAL:
|
case EQUAL:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -13,6 +14,7 @@ import com.gmail.nossr50.api.SpoutToolsAPI;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomToolConfig;
|
import com.gmail.nossr50.config.mods.CustomToolConfig;
|
||||||
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
|
|
||||||
public class ItemUtils {
|
public class ItemUtils {
|
||||||
private static Config configInstance = Config.getInstance();
|
private static Config configInstance = Config.getInstance();
|
||||||
@ -535,7 +537,7 @@ public class ItemUtils {
|
|||||||
* @return True if the item can be shared.
|
* @return True if the item can be shared.
|
||||||
*/
|
*/
|
||||||
public static boolean isShareable(ItemStack is) {
|
public static boolean isShareable(ItemStack is) {
|
||||||
return isMiningDrop(is) || isWoodcuttingDrop(is) || isMobDrop(is) || isHerbalismDrop(is);
|
return isMiningDrop(is) || isWoodcuttingDrop(is) || isMobDrop(is) || isHerbalismDrop(is) || isMiscDrop(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -572,6 +574,12 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see if an item is a herbalism drop.
|
||||||
|
*
|
||||||
|
* @param is Item to check
|
||||||
|
* @return true if the item is a herbalism drop, false otherwise
|
||||||
|
*/
|
||||||
public static boolean isHerbalismDrop(ItemStack is) {
|
public static boolean isHerbalismDrop(ItemStack is) {
|
||||||
switch (is.getType()) {
|
switch (is.getType()) {
|
||||||
case WHEAT:
|
case WHEAT:
|
||||||
@ -599,6 +607,12 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see if an item is a mob drop.
|
||||||
|
*
|
||||||
|
* @param is Item to check
|
||||||
|
* @return true if the item is a mob drop, false otherwise
|
||||||
|
*/
|
||||||
public static boolean isMobDrop(ItemStack is) {
|
public static boolean isMobDrop(ItemStack is) {
|
||||||
switch (is.getType()) {
|
switch (is.getType()) {
|
||||||
case STRING:
|
case STRING:
|
||||||
@ -635,6 +649,12 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see if an item is a woodcutting drop.
|
||||||
|
*
|
||||||
|
* @param is Item to check
|
||||||
|
* @return true if the item is a woodcutting drop, false otherwise
|
||||||
|
*/
|
||||||
public static boolean isWoodcuttingDrop(ItemStack is) {
|
public static boolean isWoodcuttingDrop(ItemStack is) {
|
||||||
switch (is.getType()) {
|
switch (is.getType()) {
|
||||||
case LOG:
|
case LOG:
|
||||||
@ -648,6 +668,22 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see if an item is a miscellaneous drop. These items are read from the config file
|
||||||
|
*
|
||||||
|
* @param is Item to check
|
||||||
|
* @return true if the item is a miscellaneous drop, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean isMiscDrop(ItemStack is) {
|
||||||
|
HashSet<Material> miscItems = ItemWeightConfig.getInstance().getMiscItems();
|
||||||
|
|
||||||
|
if (miscItems.contains(is.getType())) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isMcMMOItem(ItemStack is) {
|
public static boolean isMcMMOItem(ItemStack is) {
|
||||||
if (!is.hasItemMeta()) {
|
if (!is.hasItemMeta()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -23,4 +23,45 @@ Item_Weights:
|
|||||||
Redstone_Ore: 30
|
Redstone_Ore: 30
|
||||||
Glowstone_Dust: 20
|
Glowstone_Dust: 20
|
||||||
Coal: 10
|
Coal: 10
|
||||||
Coal_Ore: 10
|
Coal_Ore: 10
|
||||||
|
|
||||||
|
# Items in this section will get added to the Misc share category.
|
||||||
|
# Case insensitive, though the name must be exactly the same as set in the Bukkit Material enum.
|
||||||
|
Party_Shareables:
|
||||||
|
Misc_Items:
|
||||||
|
- Diamond_Sword
|
||||||
|
- Diamond_Spade
|
||||||
|
- Diamond_Pickaxe
|
||||||
|
- Diamond_Axe
|
||||||
|
- Gold_Sword
|
||||||
|
- Gold_Spade
|
||||||
|
- Gold_Pickaxe
|
||||||
|
- Gold_Axe
|
||||||
|
- Iron_Sword
|
||||||
|
- Iron_Spade
|
||||||
|
- Iron_Pickaxe
|
||||||
|
- Iron_Axe
|
||||||
|
- Stone_Sword
|
||||||
|
- Stone_Spade
|
||||||
|
- Stone_Pickaxe
|
||||||
|
- Stone_Axe
|
||||||
|
- Wood_Sword
|
||||||
|
- Wood_Spade
|
||||||
|
- Wood_Pickaxe
|
||||||
|
- Wood_Axe
|
||||||
|
- Diamond_Helmet
|
||||||
|
- Diamond_Chestplate
|
||||||
|
- Diamond_Leggings
|
||||||
|
- Diamond_Boots
|
||||||
|
- Gold_Helmet
|
||||||
|
- Gold_Chestplate
|
||||||
|
- Gold_Leggings
|
||||||
|
- Gold_Boots
|
||||||
|
- Iron_Helmet
|
||||||
|
- Iron_Chestplate
|
||||||
|
- Iron_Leggings
|
||||||
|
- Iron_Boots
|
||||||
|
- Leather_Helmet
|
||||||
|
- Leather_Chestplate
|
||||||
|
- Leather_Leggings
|
||||||
|
- Leather_Boots
|
Loading…
Reference in New Issue
Block a user