mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Merge pull request #3104 from kanesada2/skeleton
Fix shake from WITHER-SKELETON. avoid to use depredated method: getSkeltonType().
This commit is contained in:
commit
6297e1c79b
16
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java
Normal file → Executable file
16
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java
Normal file → Executable file
@ -14,7 +14,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.material.Dye;
|
import org.bukkit.material.Dye;
|
||||||
import org.bukkit.potion.Potion;
|
|
||||||
import org.bukkit.potion.PotionData;
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
|
|
||||||
@ -67,6 +66,7 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
public List<ShakeTreasure> shakeFromSnowman = new ArrayList<ShakeTreasure>();
|
public List<ShakeTreasure> shakeFromSnowman = new ArrayList<ShakeTreasure>();
|
||||||
public List<ShakeTreasure> shakeFromSquid = new ArrayList<ShakeTreasure>();
|
public List<ShakeTreasure> shakeFromSquid = new ArrayList<ShakeTreasure>();
|
||||||
public List<ShakeTreasure> shakeFromWitch = new ArrayList<ShakeTreasure>();
|
public List<ShakeTreasure> shakeFromWitch = new ArrayList<ShakeTreasure>();
|
||||||
|
public List<ShakeTreasure> shakeFromWitherSkeleton = new ArrayList<ShakeTreasure>();
|
||||||
public List<ShakeTreasure> shakeFromZombie = new ArrayList<ShakeTreasure>();
|
public List<ShakeTreasure> shakeFromZombie = new ArrayList<ShakeTreasure>();
|
||||||
public List<ShakeTreasure> shakeFromRabbit = new ArrayList<ShakeTreasure>();
|
public List<ShakeTreasure> shakeFromRabbit = new ArrayList<ShakeTreasure>();
|
||||||
public List<ShakeTreasure> shakeFromElderGuardian = new ArrayList<ShakeTreasure>();
|
public List<ShakeTreasure> shakeFromElderGuardian = new ArrayList<ShakeTreasure>();
|
||||||
@ -133,19 +133,19 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadTreaures("Fishing");
|
loadTreasures("Fishing");
|
||||||
loadTreaures("Excavation");
|
loadTreasures("Excavation");
|
||||||
loadTreaures("Hylian_Luck");
|
loadTreasures("Hylian_Luck");
|
||||||
loadEnchantments();
|
loadEnchantments();
|
||||||
|
|
||||||
for (EntityType entity : EntityType.values()) {
|
for (EntityType entity : EntityType.values()) {
|
||||||
if (entity.isAlive()) {
|
if (entity.isAlive()) {
|
||||||
loadTreaures("Shake." + entity.toString());
|
loadTreasures("Shake." + entity.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadTreaures(String type) {
|
private void loadTreasures(String type) {
|
||||||
boolean isFishing = type.equals("Fishing");
|
boolean isFishing = type.equals("Fishing");
|
||||||
boolean isShake = type.contains("Shake");
|
boolean isShake = type.contains("Shake");
|
||||||
boolean isExcavation = type.equals("Excavation");
|
boolean isExcavation = type.equals("Excavation");
|
||||||
@ -178,6 +178,8 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
|
|
||||||
if (materialName.contains("INK_SACK")) {
|
if (materialName.contains("INK_SACK")) {
|
||||||
material = Material.INK_SACK;
|
material = Material.INK_SACK;
|
||||||
|
} else if(materialName.contains("COAL")){
|
||||||
|
material = Material.COAL;
|
||||||
} else if (materialName.contains("INVENTORY")) {
|
} else if (materialName.contains("INVENTORY")) {
|
||||||
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||||
shakeFromPlayer.add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
shakeFromPlayer.add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
||||||
@ -365,6 +367,8 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
shakeFromSquid.add(shakeTreasure);
|
shakeFromSquid.add(shakeTreasure);
|
||||||
} else if (type.equals("Shake.WITCH")) {
|
} else if (type.equals("Shake.WITCH")) {
|
||||||
shakeFromWitch.add(shakeTreasure);
|
shakeFromWitch.add(shakeTreasure);
|
||||||
|
} else if (type.equals("Shake.WITHER_SKELETON")) {
|
||||||
|
shakeFromWitherSkeleton.add(shakeTreasure);
|
||||||
} else if (type.equals("Shake.ZOMBIE")) {
|
} else if (type.equals("Shake.ZOMBIE")) {
|
||||||
shakeFromZombie.add(shakeTreasure);
|
shakeFromZombie.add(shakeTreasure);
|
||||||
} else if (type.equals("Shake.RABBIT")) {
|
} else if (type.equals("Shake.RABBIT")) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.fishing;
|
package com.gmail.nossr50.skills.fishing;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -131,6 +130,8 @@ public final class Fishing {
|
|||||||
|
|
||||||
case WITCH:
|
case WITCH:
|
||||||
return TreasureConfig.getInstance().shakeFromWitch;
|
return TreasureConfig.getInstance().shakeFromWitch;
|
||||||
|
case WITHER_SKELETON:
|
||||||
|
return TreasureConfig.getInstance().shakeFromWitherSkeleton;
|
||||||
|
|
||||||
case ZOMBIE:
|
case ZOMBIE:
|
||||||
return TreasureConfig.getInstance().shakeFromZombie;
|
return TreasureConfig.getInstance().shakeFromZombie;
|
||||||
|
@ -10,7 +10,6 @@ import java.util.Map;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.WeatherType;
|
import org.bukkit.WeatherType;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -23,8 +22,6 @@ 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.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
@ -448,24 +445,11 @@ public class FishingManager extends SkillManager {
|
|||||||
sheep.setSheared(true);
|
sheep.setSheared(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WITHER_SKELETON:
|
||||||
case SKELETON:
|
if(drop.getType() == Material.SKULL_ITEM){
|
||||||
if (((Skeleton) target).getSkeletonType() == SkeletonType.WITHER) {
|
|
||||||
switch (drop.getType()) {
|
|
||||||
case SKULL_ITEM:
|
|
||||||
drop.setDurability((short) 1);
|
drop.setDurability((short) 1);
|
||||||
break;
|
|
||||||
|
|
||||||
case ARROW:
|
|
||||||
drop.setType(Material.COAL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
17
src/main/resources/treasures.yml
Normal file → Executable file
17
src/main/resources/treasures.yml
Normal file → Executable file
@ -919,6 +919,23 @@ Shake:
|
|||||||
XP: 0
|
XP: 0
|
||||||
Drop_Chance: 15.0
|
Drop_Chance: 15.0
|
||||||
Drop_Level: 0
|
Drop_Level: 0
|
||||||
|
WITHER_SKELETON:
|
||||||
|
SKULL_ITEM:
|
||||||
|
Data: 0
|
||||||
|
Amount: 1
|
||||||
|
XP: 0
|
||||||
|
Drop_Chance: 2.0
|
||||||
|
Drop_Level: 0
|
||||||
|
BONE:
|
||||||
|
Amount: 1
|
||||||
|
XP: 0
|
||||||
|
Drop_Chance: 49.0
|
||||||
|
Drop_Level: 0
|
||||||
|
COAL:
|
||||||
|
Amount: 2
|
||||||
|
XP: 0
|
||||||
|
Drop_Chance: 49.0
|
||||||
|
Drop_Level: 0
|
||||||
ZOMBIE:
|
ZOMBIE:
|
||||||
SKULL_ITEM:
|
SKULL_ITEM:
|
||||||
Data: 2
|
Data: 2
|
||||||
|
Loading…
Reference in New Issue
Block a user