Merge pull request #340 from TfT-02/master

Small patch
This commit is contained in:
Grant 2012-12-24 08:54:51 -08:00
commit 3289215e19
4 changed files with 18 additions and 40 deletions

View File

@ -14,8 +14,6 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.World;
import com.gmail.nossr50.commands.general.AddlevelsCommand; import com.gmail.nossr50.commands.general.AddlevelsCommand;
import com.gmail.nossr50.commands.general.AddxpCommand; import com.gmail.nossr50.commands.general.AddxpCommand;
import com.gmail.nossr50.commands.general.InspectCommand; import com.gmail.nossr50.commands.general.InspectCommand;

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.gathering; package com.gmail.nossr50.skills.gathering;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -14,6 +13,8 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep; import org.bukkit.entity.Sheep;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Wool; import org.bukkit.material.Wool;
@ -261,7 +262,7 @@ public class Fishing {
break; break;
case CREEPER: case CREEPER:
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
@ -281,7 +282,7 @@ public class Fishing {
break; break;
case IRON_GOLEM: case IRON_GOLEM:
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} else if (DROP_NUMBER > 85) { } else if (DROP_NUMBER > 85) {
Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); Misc.dropItem(location, new ItemStack(Material.IRON_INGOT));
@ -337,29 +338,8 @@ public class Fishing {
break; break;
case SKELETON: case SKELETON:
Object o; if (((Skeleton)le).getSkeletonType() == SkeletonType.WITHER) {
Class c; if (DROP_NUMBER > 97) {
Method m;
o = le;
c = o.getClass();
boolean isWitherSkeleton = false;
try {
m = c.getDeclaredMethod("getHandle");
o = m.invoke(o);
c = o.getClass();
m = c.getDeclaredMethod("getSkeletonType");
o = m.invoke(o);
if(o instanceof Integer)
isWitherSkeleton = (((Integer) o) == 1);
} catch(Exception e) {}
if (isWitherSkeleton) {
if (DROP_NUMBER > 95) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
} else if (DROP_NUMBER > 50) { } else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
@ -368,7 +348,7 @@ public class Fishing {
Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2); Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2);
} }
} else { } else {
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
} else if (DROP_NUMBER > 50) { } else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
@ -384,7 +364,7 @@ public class Fishing {
break; break;
case SNOWMAN: case SNOWMAN:
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.SNOW_BALL)); Misc.dropItem(location, new ItemStack(Material.SNOW_BALL));
@ -401,7 +381,7 @@ public class Fishing {
break; break;
case SQUID: case SQUID:
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0));
break; break;
case WITCH: case WITCH:
@ -436,7 +416,7 @@ public class Fishing {
break; break;
case ZOMBIE: case ZOMBIE:
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));

View File

@ -210,12 +210,12 @@ public class Repair {
* @return The final amount of durability repaired to the item * @return The final amount of durability repaired to the item
*/ */
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
double bonus; float bonus;
if(skillLevel >= repairMasteryMaxBonusLevel) bonus = (double) repairMasteryChanceMax; if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax;
else bonus = ((double) skillLevel / (double) repairMasteryMaxBonusLevel) * (double) repairMasteryChanceMax; else bonus = (skillLevel / repairMasteryMaxBonusLevel) * repairMasteryChanceMax;
if (permInstance.repairMastery(player)) { if (permInstance.repairMastery(player)) {
bonus = ((double) repairAmount * bonus); bonus = (repairAmount * bonus);
repairAmount += (int) bonus; repairAmount += (int) bonus;
} }

View File

@ -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"));