mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Fixed a bug where Herablism magically converted potatoes to carrots.
This commit is contained in:
parent
2b269ebf54
commit
6d42d14575
@ -446,7 +446,7 @@ public class Herbalism {
|
|||||||
case CARROT:
|
case CARROT:
|
||||||
Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM));
|
Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM));
|
||||||
Misc.randomDropItems(location, new ItemStack(Material.CARROT_ITEM), 50, 3);
|
Misc.randomDropItems(location, new ItemStack(Material.CARROT_ITEM), 50, 3);
|
||||||
inventory.removeItem(new ItemStack(Material.POTATO_ITEM));
|
inventory.removeItem(new ItemStack(Material.CARROT_ITEM));
|
||||||
break;
|
break;
|
||||||
case POTATO:
|
case POTATO:
|
||||||
Misc.dropItem(location, new ItemStack(Material.POTATO_ITEM));
|
Misc.dropItem(location, new ItemStack(Material.POTATO_ITEM));
|
||||||
|
@ -19,97 +19,97 @@ import com.gmail.nossr50.util.Users;
|
|||||||
|
|
||||||
public class Salvage {
|
public class Salvage {
|
||||||
|
|
||||||
private static Config configInstance = Config.getInstance();
|
private static Config configInstance = Config.getInstance();
|
||||||
private static Permissions permInstance = Permissions.getInstance();
|
private static Permissions permInstance = Permissions.getInstance();
|
||||||
|
|
||||||
public static void handleSalvage(final Player player, final Location location, final ItemStack inHand) {
|
public static void handleSalvage(final Player player, final Location location, final ItemStack inHand) {
|
||||||
if (!permInstance.salvage(player) || !configInstance.getSalvageEnabled()) {
|
if (!permInstance.salvage(player) || !configInstance.getSalvageEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlayerProfile profile = Users.getProfile(player);
|
final PlayerProfile profile = Users.getProfile(player);
|
||||||
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||||
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
||||||
|
|
||||||
if (skillLevel >= unlockLevel) {
|
if (skillLevel >= unlockLevel) {
|
||||||
final World world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
final float currentdura = inHand.getDurability();
|
final float currentdura = inHand.getDurability();
|
||||||
|
|
||||||
if (currentdura == 0) {
|
if (currentdura == 0) {
|
||||||
final int salvagedAmount = getSalvagedAmount(inHand);
|
final int salvagedAmount = getSalvagedAmount(inHand);
|
||||||
final int itemID = getSalvagedItemID(inHand);
|
final int itemID = getSalvagedItemID(inHand);
|
||||||
|
|
||||||
player.setItemInHand(new ItemStack(0));
|
player.setItemInHand(new ItemStack(0));
|
||||||
location.setY(location.getY() + 1);
|
location.setY(location.getY() + 1);
|
||||||
world.dropItem(location, new ItemStack(itemID, salvagedAmount));
|
world.dropItem(location, new ItemStack(itemID, salvagedAmount));
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles notifications for placing an anvil.
|
* Handles notifications for placing an anvil.
|
||||||
*
|
*
|
||||||
* @param player The player placing the anvil
|
* @param player The player placing the anvil
|
||||||
* @param anvilID The item ID of the anvil block
|
* @param anvilID The item ID of the anvil block
|
||||||
*/
|
*/
|
||||||
public static void placedAnvilCheck(final Player player, final int anvilID) {
|
public static void placedAnvilCheck(final Player player, final int anvilID) {
|
||||||
final PlayerProfile profile = Users.getProfile(player);
|
final PlayerProfile profile = Users.getProfile(player);
|
||||||
|
|
||||||
if (!profile.getPlacedSalvageAnvil()) {
|
if (!profile.getPlacedSalvageAnvil()) {
|
||||||
if (mcMMO.spoutEnabled) {
|
if (mcMMO.spoutEnabled) {
|
||||||
final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||||
|
|
||||||
if (spoutPlayer.isSpoutCraftEnabled()) {
|
if (spoutPlayer.isSpoutCraftEnabled()) {
|
||||||
spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID));
|
spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil2"));
|
player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.togglePlacedSalvageAnvil();
|
profile.togglePlacedSalvageAnvil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSalvagedItemID(final ItemStack inHand) {
|
public static int getSalvagedItemID(final ItemStack inHand) {
|
||||||
int salvagedItem = 0;
|
int salvagedItem = 0;
|
||||||
if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) salvagedItem = 264;
|
if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) salvagedItem = 264;
|
||||||
else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) salvagedItem = 266;
|
else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) salvagedItem = 266;
|
||||||
else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)) salvagedItem = 265;
|
else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)) salvagedItem = 265;
|
||||||
else if (ItemChecks.isStoneTool(inHand)) salvagedItem = 4;
|
else if (ItemChecks.isStoneTool(inHand)) salvagedItem = 4;
|
||||||
else if (ItemChecks.isWoodTool(inHand)) salvagedItem = 5;
|
else if (ItemChecks.isWoodTool(inHand)) salvagedItem = 5;
|
||||||
else if ( ItemChecks.isLeatherArmor(inHand)) salvagedItem = 334;
|
else if ( ItemChecks.isLeatherArmor(inHand)) salvagedItem = 334;
|
||||||
return salvagedItem;
|
return salvagedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSalvagedAmount(final ItemStack inHand) {
|
public static int getSalvagedAmount(final ItemStack inHand) {
|
||||||
int salvagedAmount = 0;
|
int salvagedAmount = 0;
|
||||||
if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) salvagedAmount = 3;
|
if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) salvagedAmount = 3;
|
||||||
else if (ItemChecks.isShovel(inHand)) salvagedAmount = 1;
|
else if (ItemChecks.isShovel(inHand)) salvagedAmount = 1;
|
||||||
else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) salvagedAmount = 2;
|
else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) salvagedAmount = 2;
|
||||||
else if (ItemChecks.isHelmet(inHand)) salvagedAmount = 5;
|
else if (ItemChecks.isHelmet(inHand)) salvagedAmount = 5;
|
||||||
else if (ItemChecks.isChestplate(inHand)) salvagedAmount = 8;
|
else if (ItemChecks.isChestplate(inHand)) salvagedAmount = 8;
|
||||||
else if (ItemChecks.isPants(inHand)) salvagedAmount = 7;
|
else if (ItemChecks.isPants(inHand)) salvagedAmount = 7;
|
||||||
else if (ItemChecks.isBoots(inHand)) salvagedAmount = 4;
|
else if (ItemChecks.isBoots(inHand)) salvagedAmount = 4;
|
||||||
return salvagedAmount;
|
return salvagedAmount;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Checks if the item is salvageable.
|
* Checks if the item is salvageable.
|
||||||
*
|
*
|
||||||
* @param is Item to check
|
* @param is Item to check
|
||||||
* @return true if the item is salvageable, false otherwise
|
* @return true if the item is salvageable, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isSalvageable(final ItemStack is) {
|
public static boolean isSalvageable(final ItemStack is) {
|
||||||
if (configInstance.getSalvageTools() && ItemChecks.isTool(is)) {
|
if (configInstance.getSalvageTools() && ItemChecks.isTool(is)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (configInstance.getSalvageArmor() && ItemChecks.isArmor(is)) {
|
if (configInstance.getSalvageArmor() && ItemChecks.isArmor(is)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ChunkletUnloader.addToList(cx, cx, world);
|
ChunkletUnloader.addToList(cx, cz, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user