mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Now uses proper gamemode check and uses Misc.dropItem
This commit is contained in:
parent
7500685115
commit
4511dd79fa
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
@ -14,6 +14,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.ItemChecks;
|
import com.gmail.nossr50.util.ItemChecks;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
@ -27,13 +28,12 @@ public class Salvage {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getGameMode().equals(0)){
|
if(player.getGameMode() == GameMode.SURVIVAL) {
|
||||||
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 float currentdura = inHand.getDurability();
|
final float currentdura = inHand.getDurability();
|
||||||
|
|
||||||
if (currentdura == 0) {
|
if (currentdura == 0) {
|
||||||
@ -42,7 +42,7 @@ public class Salvage {
|
|||||||
|
|
||||||
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));
|
Misc.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"));
|
||||||
|
Loading…
Reference in New Issue
Block a user