mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed a small bug where players could salvage items in creative mode
This commit is contained in:
parent
fd5de7b218
commit
7f16339bd9
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
# Eclipse stuffs
|
# Eclipse stuff
|
||||||
/.classpath
|
/.classpath
|
||||||
/.project
|
/.project
|
||||||
/.settings
|
/.settings
|
||||||
|
@ -27,27 +27,29 @@ public class Salvage {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlayerProfile profile = Users.getProfile(player);
|
if (player.getGameMode().equals(0)){
|
||||||
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
final PlayerProfile profile = Users.getProfile(player);
|
||||||
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||||
|
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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user