1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-20 18:53:11 +01:00

Compare commits

..

1 Commits

Author SHA1 Message Date
t00thpick1
13e7788b14 Fix off-by-one chunk coords calculation for ChunkStore. 2014-02-03 08:56:22 -05:00
41 changed files with 791 additions and 844 deletions

View File

@@ -20,7 +20,6 @@ Version 1.4.08-dev
+ Added new experience bonus perk 'mcmmo.perks.xp.10percentboost.<skillname>' multiplies incoming XP by 1.1 + Added new experience bonus perk 'mcmmo.perks.xp.10percentboost.<skillname>' multiplies incoming XP by 1.1
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config + Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default + Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
= Fixed bug where LeafBlower permissions were ignored = Fixed bug where LeafBlower permissions were ignored
= Fixed bug with toggle commands not properly displaying the success message. = Fixed bug with toggle commands not properly displaying the success message.
= Fixed IllegalArgumentException caused by an empty Fishing treasure category = Fixed IllegalArgumentException caused by an empty Fishing treasure category

View File

@@ -376,7 +376,7 @@ public class Config extends AutoUpdateConfigLoader {
public int getPTPCommandWarmup() { return config.getInt("Commands.ptp.Warmup", 5); } public int getPTPCommandWarmup() { return config.getInt("Commands.ptp.Warmup", 5); }
public int getPTPCommandRecentlyHurtCooldown() { return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60); } public int getPTPCommandRecentlyHurtCooldown() { return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60); }
public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); } public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Accept_Required", true); } public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Confirm_Required", true); }
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); } public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
/* Inspect command distance */ /* Inspect command distance */

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
import java.io.File;
import java.util.regex.Pattern;
public class ArmorConfigManager {
public ArmorConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "armor.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "armor.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomArmor(new CustomArmorConfig(fileName));
}
}
}

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
import java.io.File;
import java.util.regex.Pattern;
public class BlockConfigManager {
public BlockConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "blocks.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "blocks.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
}
}
}

View File

@@ -16,22 +16,42 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
public class CustomArmorConfig extends ConfigLoader { public class CustomArmorConfig extends ConfigLoader {
private static CustomArmorConfig instance;
private boolean needsUpdate = false; private boolean needsUpdate = false;
public List<Material> customBoots = new ArrayList<Material>(); private List<Repairable> repairables;
public List<Material> customChestplates = new ArrayList<Material>();
public List<Material> customHelmets = new ArrayList<Material>();
public List<Material> customLeggings = new ArrayList<Material>();
public List<Repairable> repairables = new ArrayList<Repairable>(); private List<Material> customBoots = new ArrayList<Material>();
private List<Material> customChestplates = new ArrayList<Material>();
private List<Material> customHelmets = new ArrayList<Material>();
private List<Material> customLeggings = new ArrayList<Material>();
protected CustomArmorConfig(String fileName) { public CustomArmorConfig() {
super("mods", fileName); super("mods", "armor.yml");
loadKeys(); loadKeys();
} }
public static CustomArmorConfig getInstance() {
if (instance == null) {
instance = new CustomArmorConfig();
}
return instance;
}
public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
@Override @Override
protected void loadKeys() { protected void loadKeys() {
repairables = new ArrayList<Repairable>();
loadArmor("Boots", customBoots); loadArmor("Boots", customBoots);
loadArmor("Chestplates", customChestplates); loadArmor("Chestplates", customChestplates);
loadArmor("Helmets", customHelmets); loadArmor("Helmets", customHelmets);
@@ -97,4 +117,20 @@ public class CustomArmorConfig extends ConfigLoader {
materialList.add(armorMaterial); materialList.add(armorMaterial);
} }
} }
public boolean isCustomBoots(Material material) {
return customBoots.contains(material);
}
public boolean isCustomChestplate(Material material) {
return customChestplates.contains(material);
}
public boolean isCustomHelmet(Material material) {
return customHelmets.contains(material);
}
public boolean isCustomLeggings(Material material) {
return customLeggings.contains(material);
}
} }

View File

@@ -13,29 +13,40 @@ import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.mods.CustomBlock; import com.gmail.nossr50.datatypes.mods.CustomBlock;
public class CustomBlockConfig extends ConfigLoader { public class CustomBlockConfig extends ConfigLoader {
private static CustomBlockConfig instance;
private boolean needsUpdate = false; private boolean needsUpdate = false;
public List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>(); private List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>(); private List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>(); private List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customOres = new ArrayList<MaterialData>(); private List<MaterialData> customWoodcuttingBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customLogs = new ArrayList<MaterialData>(); private List<MaterialData> customOres = new ArrayList<MaterialData>();
public List<MaterialData> customLeaves = new ArrayList<MaterialData>(); private List<MaterialData> customLogs = new ArrayList<MaterialData>();
public List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>(); private List<MaterialData> customLeaves = new ArrayList<MaterialData>();
private List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
public HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>(); private HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
protected CustomBlockConfig(String fileName) { public CustomBlockConfig() {
super("mods", fileName); super("mods", "blocks.yml");
loadKeys(); loadKeys();
} }
public static CustomBlockConfig getInstance() {
if (instance == null) {
instance = new CustomBlockConfig();
}
return instance;
}
@Override @Override
protected void loadKeys() { protected void loadKeys() {
loadBlocks("Excavation", customExcavationBlocks); loadBlocks("Excavation", customExcavationBlocks);
loadBlocks("Herbalism", customHerbalismBlocks); loadBlocks("Herbalism", customHerbalismBlocks);
loadBlocks("Mining", customMiningBlocks); loadBlocks("Mining", customMiningBlocks);
loadBlocks("Woodcutting", null); loadBlocks("Woodcutting", customWoodcuttingBlocks);
loadBlocks("Ability_Blocks", customAbilityBlocks); loadBlocks("Ability_Blocks", customAbilityBlocks);
if (needsUpdate) { if (needsUpdate) {
@@ -74,10 +85,7 @@ public class CustomBlockConfig extends ConfigLoader {
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0; byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData); MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
blockList.add(blockMaterialData);
if (blockList != null) {
blockList.add(blockMaterialData);
}
if (skillType.equals("Ability_Blocks")) { if (skillType.equals("Ability_Blocks")) {
continue; continue;
@@ -103,4 +111,40 @@ public class CustomBlockConfig extends ConfigLoader {
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp)); customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
} }
} }
public CustomBlock getCustomBlock(MaterialData data) {
return customBlockMap.get(data);
}
public boolean isCustomOre(MaterialData data) {
return customOres.contains(data);
}
public boolean isCustomLog(MaterialData data) {
return customLogs.contains(data);
}
public boolean isCustomLeaf(MaterialData data) {
return customLeaves.contains(data);
}
public boolean isCustomAbilityBlock(MaterialData data) {
return customAbilityBlocks.contains(data);
}
public boolean isCustomExcavationBlock(MaterialData data) {
return customExcavationBlocks.contains(data);
}
public boolean isCustomHerbalismBlock(MaterialData data) {
return customHerbalismBlocks.contains(data);
}
public boolean isCustomMiningBlock(MaterialData data) {
return customMiningBlocks.contains(data);
}
public boolean isCustomWoodcuttingBlock(MaterialData data) {
return customWoodcuttingBlocks.contains(data);
}
} }

View File

@@ -3,6 +3,7 @@ package com.gmail.nossr50.config.mods;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.config.ConfigLoader;
@@ -11,14 +12,24 @@ import com.gmail.nossr50.datatypes.mods.CustomEntity;
import org.apache.commons.lang.ClassUtils; import org.apache.commons.lang.ClassUtils;
public class CustomEntityConfig extends ConfigLoader { public class CustomEntityConfig extends ConfigLoader {
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>(); private static CustomEntityConfig instance;
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
protected CustomEntityConfig(String fileName) { private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
super("mods", fileName); private HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
public CustomEntityConfig() {
super("mods", "entities.yml");
loadKeys(); loadKeys();
} }
public static CustomEntityConfig getInstance() {
if (instance == null) {
instance = new CustomEntityConfig();
}
return instance;
}
@Override @Override
protected void loadKeys() { protected void loadKeys() {
if (config.getConfigurationSection("Hostile") != null) { if (config.getConfigurationSection("Hostile") != null) {
@@ -60,4 +71,47 @@ public class CustomEntityConfig extends ConfigLoader {
customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity); customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity);
} }
} }
public boolean isCustomEntity(Entity entity) {
if (customEntityTypeMap.containsKey(entity.getType().toString())) {
return true;
}
try {
return customEntityClassMap.containsKey(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
return customEntityClassMap.containsKey(entity.getClass().getName());
}
e.printStackTrace();
return false;
}
}
public CustomEntity getCustomEntity(Entity entity) {
CustomEntity customEntity = customEntityTypeMap.get(entity.getType().toString());
if (customEntity == null) {
try {
customEntity = customEntityClassMap.get(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
customEntity = customEntityClassMap.get(entity.getClass().getName());
}
else {
e.printStackTrace();
}
}
}
return customEntity;
}
public void addEntity(CustomEntity customEntity, String className, String entityName) {
customEntityTypeMap.put(entityName, customEntity);
customEntityClassMap.put(className, customEntity);
}
} }

View File

@@ -18,26 +18,46 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
public class CustomToolConfig extends ConfigLoader { public class CustomToolConfig extends ConfigLoader {
private static CustomToolConfig instance;
private boolean needsUpdate = false; private boolean needsUpdate = false;
public List<Material> customAxes = new ArrayList<Material>(); private List<Repairable> repairables;
public List<Material> customBows = new ArrayList<Material>();
public List<Material> customHoes = new ArrayList<Material>();
public List<Material> customPickaxes = new ArrayList<Material>();
public List<Material> customShovels = new ArrayList<Material>();
public List<Material> customSwords = new ArrayList<Material>();
public HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>(); private List<Material> customAxes = new ArrayList<Material>();
private List<Material> customBows = new ArrayList<Material>();
private List<Material> customHoes = new ArrayList<Material>();
private List<Material> customPickaxes = new ArrayList<Material>();
private List<Material> customShovels = new ArrayList<Material>();
private List<Material> customSwords = new ArrayList<Material>();
public List<Repairable> repairables = new ArrayList<Repairable>(); private HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
protected CustomToolConfig(String fileName) { private CustomToolConfig() {
super("mods", fileName); super("mods", "tools.yml");
loadKeys(); loadKeys();
} }
public static CustomToolConfig getInstance() {
if (instance == null) {
instance = new CustomToolConfig();
}
return instance;
}
public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
@Override @Override
protected void loadKeys() { protected void loadKeys() {
repairables = new ArrayList<Repairable>();
loadTool("Axes", customAxes); loadTool("Axes", customAxes);
loadTool("Bows", customBows); loadTool("Bows", customBows);
loadTool("Hoes", customHoes); loadTool("Hoes", customHoes);
@@ -112,4 +132,36 @@ public class CustomToolConfig extends ConfigLoader {
customToolMap.put(toolMaterial, tool); customToolMap.put(toolMaterial, tool);
} }
} }
public boolean isCustomAxe(Material material) {
return customAxes.contains(material);
}
public boolean isCustomBow(Material material) {
return customBows.contains(material);
}
public boolean isCustomHoe(Material material) {
return customHoes.contains(material);
}
public boolean isCustomPickaxe(Material material) {
return customPickaxes.contains(material);
}
public boolean isCustomShovel(Material material) {
return customShovels.contains(material);
}
public boolean isCustomSword(Material material) {
return customSwords.contains(material);
}
public boolean isCustomTool(Material material) {
return customToolMap.containsKey(material);
}
public CustomTool getCustomTool(Material material) {
return customToolMap.get(material);
}
} }

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
import java.io.File;
import java.util.regex.Pattern;
public class EntityConfigManager {
public EntityConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.entities\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "entities.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "entities.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomEntities(new CustomEntityConfig(fileName));
}
}
}

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
import java.io.File;
import java.util.regex.Pattern;
public class ToolConfigManager {
public ToolConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.tools\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "tools.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "tools.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomTools(new CustomToolConfig(fileName));
}
}
}

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.config.skills.alchemy; package com.gmail.nossr50.config.potion;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -13,7 +13,7 @@ import org.bukkit.potion.PotionEffectType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion; import com.gmail.nossr50.datatypes.AlchemyPotion;
public class PotionConfig extends ConfigLoader { public class PotionConfig extends ConfigLoader {
private static PotionConfig instance; private static PotionConfig instance;

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.config.skills.repair; package com.gmail.nossr50.config.repair;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.config.skills.repair; package com.gmail.nossr50.config.repair;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@@ -9,9 +9,11 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
public class RepairConfigManager { public class RepairConfigManager {
private final List<Repairable> repairables = new ArrayList<Repairable>(); private List<Repairable> repairables;
public RepairConfigManager(mcMMO plugin) { public RepairConfigManager(mcMMO plugin) {
repairables = new ArrayList<Repairable>();
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml"); Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
File dataFolder = plugin.getDataFolder(); File dataFolder = plugin.getDataFolder();
File vanilla = new File(dataFolder, "repair.vanilla.yml"); File vanilla = new File(dataFolder, "repair.vanilla.yml");
@@ -32,11 +34,19 @@ public class RepairConfigManager {
} }
RepairConfig rConfig = new RepairConfig(fileName); RepairConfig rConfig = new RepairConfig(fileName);
repairables.addAll(rConfig.getLoadedRepairables()); List<Repairable> rConfigRepairables = rConfig.getLoadedRepairables();
if (rConfigRepairables != null) {
repairables.addAll(rConfigRepairables);
}
} }
} }
public List<Repairable> getLoadedRepairables() { public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables; return repairables;
} }
} }

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.datatypes.skills.alchemy; package com.gmail.nossr50.datatypes;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -47,6 +47,7 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@@ -75,9 +76,6 @@ public class McMMOPlayer {
private boolean abilityUse = true; private boolean abilityUse = true;
private boolean godMode; private boolean godMode;
private Sound recentSound;
private int lastSound;
private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>(); private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>(); private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
@@ -445,50 +443,6 @@ public class McMMOPlayer {
godMode = !godMode; godMode = !godMode;
} }
/*
* Sounds
*/
/**
* Play a sound at the players location.
* Sound will only get played if it's different
* compared to the previously played sound or if the cooldown has expired.
*
* @param sound The Sound to play
* @param volume Volume of the sound
* @param pitch Pitch of the sound
* @param cooldown Cooldown time between sounds
*/
public void playSound(Sound sound, float volume, float pitch, int cooldown) {
if (getRecentSound() == sound && !SkillUtils.cooldownExpired(getLastSound(), 1)) {
return;
}
setRecentSound(sound);
actualizeLastSound();
player.playSound(player.getLocation(), sound, volume, pitch);
}
public void playSound(Sound sound, float volume, float pitch) {
playSound(sound, volume, pitch, 1);
}
public Sound getRecentSound() {
return recentSound;
}
public void setRecentSound(Sound recentSound) {
this.recentSound = recentSound;
}
public int getLastSound() {
return lastSound;
}
public void actualizeLastSound() {
lastSound = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
}
/* /*
* Skill notifications * Skill notifications
*/ */
@@ -803,7 +757,7 @@ public class McMMOPlayer {
xp = (float) (xp / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()); xp = (float) (xp / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
if (Config.getInstance().getToolModsEnabled()) { if (Config.getInstance().getToolModsEnabled()) {
CustomTool tool = mcMMO.getModManager().getTool(player.getItemInHand()); CustomTool tool = ModUtils.getToolFromItemStack(player.getItemInHand());
if (tool != null) { if (tool != null) {
xp *= tool.getXpMultiplier(); xp *= tool.getXpMultiplier();
@@ -889,7 +843,7 @@ public class McMMOPlayer {
ItemStack inHand = player.getItemInHand(); ItemStack inHand = player.getItemInHand();
if (mcMMO.getModManager().isCustomTool(inHand) && !mcMMO.getModManager().getTool(inHand).isAbilityEnabled()) { if (ModUtils.isCustomTool(inHand) && !ModUtils.getToolFromItemStack(inHand).isAbilityEnabled()) {
return; return;
} }

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@@ -354,7 +353,6 @@ public class PlayerListener implements Listener {
BleedTimerTask.bleedOut(player); BleedTimerTask.bleedOut(player);
mcMMOPlayer.getProfile().save(); mcMMOPlayer.getProfile().save();
UserManager.remove(player.getName()); UserManager.remove(player.getName());
ScoreboardManager.teardownPlayer(player);
} }
/** /**
@@ -375,7 +373,6 @@ public class PlayerListener implements Listener {
} }
UserManager.addUser(player).actualizeRespawnATS(); UserManager.addUser(player).actualizeRespawnATS();
ScoreboardManager.setupPlayer(player);
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
Motd.displayAll(player); Motd.displayAll(player);

View File

@@ -0,0 +1,39 @@
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
public class ScoreboardsListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) {
ScoreboardManager.setupPlayer(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
ScoreboardManager.teardownPlayer(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
ScoreboardManager.handleLevelUp(event.getPlayer(), event.getSkill());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
}
}

View File

@@ -1,10 +1,5 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@@ -15,27 +10,12 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
public class SelfListener implements Listener { public class SelfListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) { public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
Player player = event.getPlayer();
SkillType skill = event.getSkill();
ScoreboardManager.handleLevelUp(player, skill);
if (!Config.getInstance().getLevelUpEffectsEnabled()) { if (!Config.getInstance().getLevelUpEffectsEnabled()) {
return; return;
} }
if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) { if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) {
skill.celebrateLevelUp(player); event.getSkill().celebrateLevelUp(event.getPlayer());
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
}
} }

View File

@@ -5,11 +5,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.gmail.nossr50.config.mods.ArmorConfigManager;
import com.gmail.nossr50.config.mods.BlockConfigManager;
import com.gmail.nossr50.config.mods.EntityConfigManager;
import com.gmail.nossr50.config.mods.ToolConfigManager;
import com.gmail.nossr50.util.ModManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
@@ -19,8 +14,12 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig; import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.skills.repair.RepairConfigManager; import com.gmail.nossr50.config.mods.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.config.potion.PotionConfig;
import com.gmail.nossr50.config.repair.RepairConfigManager;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.database.DatabaseManager; import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory; import com.gmail.nossr50.database.DatabaseManagerFactory;
@@ -28,6 +27,7 @@ import com.gmail.nossr50.listeners.BlockListener;
import com.gmail.nossr50.listeners.EntityListener; import com.gmail.nossr50.listeners.EntityListener;
import com.gmail.nossr50.listeners.InventoryListener; import com.gmail.nossr50.listeners.InventoryListener;
import com.gmail.nossr50.listeners.PlayerListener; import com.gmail.nossr50.listeners.PlayerListener;
import com.gmail.nossr50.listeners.ScoreboardsListener;
import com.gmail.nossr50.listeners.SelfListener; import com.gmail.nossr50.listeners.SelfListener;
import com.gmail.nossr50.listeners.WorldListener; import com.gmail.nossr50.listeners.WorldListener;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@@ -65,7 +65,6 @@ public class mcMMO extends JavaPlugin {
/* Managers */ /* Managers */
private static ChunkManager placeStore; private static ChunkManager placeStore;
private static RepairableManager repairableManager; private static RepairableManager repairableManager;
private static ModManager modManager;
private static DatabaseManager databaseManager; private static DatabaseManager databaseManager;
private static FormulaManager formulaManager; private static FormulaManager formulaManager;
private static HolidayManager holidayManager; private static HolidayManager holidayManager;
@@ -132,8 +131,6 @@ public class mcMMO extends JavaPlugin {
setupFilePaths(); setupFilePaths();
modManager = new ModManager();
loadConfigFiles(); loadConfigFiles();
if (!noErrorsInConfigFiles) { if (!noErrorsInConfigFiles) {
@@ -297,10 +294,6 @@ public class mcMMO extends JavaPlugin {
return databaseManager; return databaseManager;
} }
public static ModManager getModManager() {
return modManager;
}
@Deprecated @Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) { public static void setDatabaseManager(DatabaseManager databaseManager) {
mcMMO.databaseManager = databaseManager; mcMMO.databaseManager = databaseManager;
@@ -336,42 +329,13 @@ public class mcMMO extends JavaPlugin {
if (oldFlatfilePath.exists()) { if (oldFlatfilePath.exists()) {
if (!oldFlatfilePath.renameTo(new File(flatFileDirectory))) { if (!oldFlatfilePath.renameTo(new File(flatFileDirectory))) {
getLogger().warning("Failed to rename FlatFileStuff to flatfile!"); getLogger().warning("Failed to rename FlatFileStuff to flatfile !");
} }
} }
if (oldModPath.exists()) { if (oldModPath.exists()) {
if (!oldModPath.renameTo(new File(modDirectory))) { if (!oldModPath.renameTo(new File(modDirectory))) {
getLogger().warning("Failed to rename ModConfigs to mods!"); getLogger().warning("Failed to rename ModConfigs to mods !");
}
}
File oldArmorFile = new File(modDirectory + "armor.yml");
File oldBlocksFile = new File(modDirectory + "blocks.yml");
File oldEntitiesFile = new File(modDirectory + "entities.yml");
File oldToolsFile = new File(modDirectory + "tools.yml");
if (oldArmorFile.exists()) {
if (!oldArmorFile.renameTo(new File(modDirectory + "armor.default.yml"))) {
getLogger().warning("Failed to rename armor.yml to armor.default.yml!");
}
}
if (oldBlocksFile.exists()) {
if (!oldBlocksFile.renameTo(new File(modDirectory + "blocks.default.yml"))) {
getLogger().warning("Failed to rename blocks.yml to blocks.default.yml!");
}
}
if (oldEntitiesFile.exists()) {
if (!oldEntitiesFile.renameTo(new File(modDirectory + "entities.default.yml"))) {
getLogger().warning("Failed to rename entities.yml to entities.default.yml!");
}
}
if (oldToolsFile.exists()) {
if (!oldToolsFile.renameTo(new File(modDirectory + "tools.default.yml"))) {
getLogger().warning("Failed to rename tools.yml to tools.default.yml!");
} }
} }
} }
@@ -409,24 +373,24 @@ public class mcMMO extends JavaPlugin {
List<Repairable> repairables = new ArrayList<Repairable>(); List<Repairable> repairables = new ArrayList<Repairable>();
if (Config.getInstance().getToolModsEnabled()) { if (Config.getInstance().getToolModsEnabled()) {
new ToolConfigManager(this); repairables.addAll(CustomToolConfig.getInstance().getLoadedRepairables());
} }
if (Config.getInstance().getArmorModsEnabled()) { if (Config.getInstance().getArmorModsEnabled()) {
new ArmorConfigManager(this); repairables.addAll(CustomArmorConfig.getInstance().getLoadedRepairables());
} }
if (Config.getInstance().getBlockModsEnabled()) { if (Config.getInstance().getBlockModsEnabled()) {
new BlockConfigManager(this); CustomBlockConfig.getInstance();
} }
if (Config.getInstance().getEntityModsEnabled()) { if (Config.getInstance().getEntityModsEnabled()) {
new EntityConfigManager(this); CustomEntityConfig.getInstance();
} }
// Load repair configs, make manager, and register them at this time // Load repair configs, make manager, and register them at this time
repairables.addAll(new RepairConfigManager(this).getLoadedRepairables()); RepairConfigManager rManager = new RepairConfigManager(this);
repairables.addAll(modManager.getLoadedRepairables()); repairables.addAll(rManager.getLoadedRepairables());
repairableManager = new SimpleRepairableManager(repairables.size()); repairableManager = new SimpleRepairableManager(repairables.size());
repairableManager.registerRepairables(repairables); repairableManager.registerRepairables(repairables);
} }
@@ -440,6 +404,7 @@ public class mcMMO extends JavaPlugin {
pluginManager.registerEvents(new EntityListener(this), this); pluginManager.registerEvents(new EntityListener(this), this);
pluginManager.registerEvents(new InventoryListener(this), this); pluginManager.registerEvents(new InventoryListener(this), this);
pluginManager.registerEvents(new SelfListener(), this); pluginManager.registerEvents(new SelfListener(), this);
pluginManager.registerEvents(new ScoreboardsListener(), this);
pluginManager.registerEvents(new WorldListener(this), this); pluginManager.registerEvents(new WorldListener(this), this);
} }

View File

@@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.config.potion.PotionConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;

View File

@@ -18,8 +18,8 @@ import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.config.potion.PotionConfig;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion; import com.gmail.nossr50.datatypes.AlchemyPotion;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask; import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask; import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask;
@@ -230,7 +230,6 @@ public final class AlchemyPotionBrewer {
return; return;
} }
if (event.isShiftClick()) { if (event.isShiftClick()) {
if (event.getSlotType() == SlotType.FUEL) { if (event.getSlotType() == SlotType.FUEL) {
scheduleCheck(player, brewingStand); scheduleCheck(player, brewingStand);
@@ -257,10 +256,6 @@ public final class AlchemyPotionBrewer {
} }
else if (event.getRawSlot() == INGREDIENT_SLOT) { else if (event.getRawSlot() == INGREDIENT_SLOT) {
if (isEmpty(cursor) && isEmpty(clicked)) { if (isEmpty(cursor) && isEmpty(clicked)) {
if (event.getClick() == ClickType.NUMBER_KEY) {
scheduleCheck(player, brewingStand);
return;
}
return; return;
} }
else if (isEmpty(cursor)) { else if (isEmpty(cursor)) {

View File

@@ -3,13 +3,13 @@ package com.gmail.nossr50.skills.excavation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.gmail.nossr50.mcMMO;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.util.ModUtils;
public class Excavation { public class Excavation {
/** /**
@@ -52,8 +52,8 @@ public class Excavation {
protected static int getBlockXP(BlockState blockState) { protected static int getBlockXP(BlockState blockState) {
int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getType()); int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getType());
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) { if (xp == 0 && ModUtils.isCustomExcavationBlock(blockState)) {
xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); xp = ModUtils.getCustomBlock(blockState).getXpGain();
} }
return xp; return xp;

View File

@@ -32,6 +32,7 @@ import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
@@ -135,8 +136,8 @@ public class HerbalismManager extends SkillManager {
int xp; int xp;
boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility()); boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility());
if (mcMMO.getModManager().isCustomHerbalismBlock(blockState)) { if (ModUtils.isCustomHerbalismBlock(blockState)) {
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState); CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
xp = customBlock.getXpGain(); xp = customBlock.getXpGain();
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) { if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) {

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.mining; package com.gmail.nossr50.skills.mining;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -9,6 +8,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
public class Mining { public class Mining {
@@ -21,8 +21,8 @@ public class Mining {
Material blockType = blockState.getType(); Material blockType = blockState.getType();
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE); int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE);
if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) { if (xp == 0 && ModUtils.isCustomMiningBlock(blockState)) {
xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); xp = ModUtils.getCustomBlock(blockState).getXpGain();
} }
return xp; return xp;
@@ -65,7 +65,7 @@ public class Mining {
return; return;
default: default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) { if (ModUtils.isCustomMiningBlock(blockState)) {
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1)); Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
} }
return; return;
@@ -104,7 +104,7 @@ public class Mining {
return; return;
default: default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) { if (ModUtils.isCustomMiningBlock(blockState)) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
} }
return; return;

View File

@@ -23,6 +23,7 @@ import com.gmail.nossr50.skills.mining.BlastMining.Tier;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
@@ -69,7 +70,7 @@ public class MiningManager extends SkillManager {
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage()); SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
} }
if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) { if ((ModUtils.isCustomMiningBlock(blockState) && !ModUtils.getCustomBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
return; return;
} }

View File

@@ -148,7 +148,7 @@ public class RepairManager extends SkillManager {
// BWONG BWONG BWONG // BWONG BWONG BWONG
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) { if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
mcMMOPlayer.playSound(Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
} }
// Repair the item! // Repair the item!

View File

@@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class SimpleRepairableManager implements RepairableManager { public class SimpleRepairableManager implements RepairableManager {
private HashMap<Material, Repairable> repairables; private HashMap<Material, Repairable> repairables;

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.smelting; package com.gmail.nossr50.skills.smelting;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
@@ -8,6 +7,7 @@ import org.bukkit.material.MaterialData;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.ModUtils;
public class Smelting { public class Smelting {
// The order of the values is extremely important, a few methods depend on it to work properly // The order of the values is extremely important, a few methods depend on it to work properly
@@ -50,6 +50,6 @@ public class Smelting {
MaterialData data = smelting.getData(); MaterialData data = smelting.getData();
Material resourceType = smelting.getType(); Material resourceType = smelting.getType();
return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE); return ModUtils.isCustomOre(data) ? ModUtils.getCustomBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE);
} }
} }

View File

@@ -16,6 +16,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
public final class Woodcutting { public final class Woodcutting {
@@ -51,8 +52,8 @@ public final class Woodcutting {
break; break;
} }
if (mcMMO.getModManager().isCustomLog(blockState)) { if (ModUtils.isCustomLogBlock(blockState)) {
return mcMMO.getModManager().getBlock(blockState).getXpGain(); return ModUtils.getCustomBlock(blockState).getXpGain();
} }
switch (((Tree) blockState.getData()).getSpecies()) { switch (((Tree) blockState.getData()).getSpecies()) {
@@ -85,7 +86,7 @@ public final class Woodcutting {
* @param blockState Block being broken * @param blockState Block being broken
*/ */
protected static void checkForDoubleDrop(BlockState blockState) { protected static void checkForDoubleDrop(BlockState blockState) {
if (mcMMO.getModManager().isCustomLog(blockState) && mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) { if (ModUtils.isCustomLogBlock(blockState) && ModUtils.getCustomBlock(blockState).isDoubleDropEnabled()) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
} }
else { else {

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.woodcutting;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@@ -23,6 +22,7 @@ import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
@@ -126,18 +126,18 @@ public class WoodcuttingManager extends SkillManager {
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER); xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
Misc.dropItems(blockState.getLocation(), block.getDrops()); Misc.dropItems(blockState.getLocation(), block.getDrops());
} }
else if (mcMMO.getModManager().isCustomLog(blockState)) { else if (ModUtils.isCustomLogBlock(blockState)) {
if (canGetDoubleDrops()) { if (canGetDoubleDrops()) {
Woodcutting.checkForDoubleDrop(blockState); Woodcutting.checkForDoubleDrop(blockState);
} }
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState); CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
xp = customBlock.getXpGain(); xp = customBlock.getXpGain();
Misc.dropItems(blockState.getLocation(), block.getDrops()); Misc.dropItems(blockState.getLocation(), block.getDrops());
} }
else if (mcMMO.getModManager().isCustomLeaf(blockState)) { else if (ModUtils.isCustomLeafBlock(blockState)) {
Misc.dropItems(blockState.getLocation(), block.getDrops()); Misc.randomDropItems(blockState.getLocation(), block.getDrops(), 10.0);
} }
else { else {
Tree tree = (Tree) blockState.getData(); Tree tree = (Tree) blockState.getData();

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.util;
import java.util.HashSet; import java.util.HashSet;
import com.gmail.nossr50.mcMMO;
import org.bukkit.CropState; import org.bukkit.CropState;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NetherWartsState; import org.bukkit.NetherWartsState;
@@ -65,7 +64,7 @@ public final class BlockUtils {
return false; return false;
default: default:
return !isMcMMOAnvil(blockState) && !mcMMO.getModManager().isCustomAbilityBlock(blockState); return !isMcMMOAnvil(blockState) && !ModUtils.isCustomAbilityBlock(blockState);
} }
} }
@@ -136,7 +135,7 @@ public final class BlockUtils {
return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE; return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;
default: default:
return mcMMO.getModManager().isCustomHerbalismBlock(blockState); return ModUtils.isCustomHerbalismBlock(blockState);
} }
} }
@@ -158,7 +157,7 @@ public final class BlockUtils {
return true; return true;
default: default:
return isOre(blockState) || mcMMO.getModManager().isCustomMiningBlock(blockState); return isOre(blockState) || ModUtils.isCustomMiningBlock(blockState);
} }
} }
@@ -182,7 +181,7 @@ public final class BlockUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomExcavationBlock(blockState); return ModUtils.isCustomExcavationBlock(blockState);
} }
} }
@@ -200,7 +199,7 @@ public final class BlockUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomLog(blockState); return ModUtils.isCustomLogBlock(blockState);
} }
} }
@@ -216,7 +215,7 @@ public final class BlockUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomLeaf(blockState); return ModUtils.isCustomLeafBlock(blockState);
} }
} }

View File

@@ -10,6 +10,9 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.config.party.ItemWeightConfig; import com.gmail.nossr50.config.party.ItemWeightConfig;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@@ -30,7 +33,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomBow(type); return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomBow(type));
} }
} }
@@ -52,7 +55,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomSword(type); return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomSword(type));
} }
} }
@@ -74,7 +77,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomHoe(type); return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomHoe(type));
} }
} }
@@ -96,7 +99,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomShovel(type); return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomShovel(type));
} }
} }
@@ -118,7 +121,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomAxe(type); return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomAxe(type));
} }
} }
@@ -140,7 +143,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomPickaxe(type); return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomPickaxe(type));
} }
} }
@@ -162,7 +165,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomHelmet(type); return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomHelmet(type);
} }
} }
@@ -184,7 +187,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomChestplate(type); return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomChestplate(type);
} }
} }
@@ -206,7 +209,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomLeggings(type); return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomLeggings(type);
} }
} }
@@ -228,7 +231,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomBoots(type); return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomBoots(type);
} }
} }

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import com.gmail.nossr50.mcMMO;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
public final class MaterialUtils { public final class MaterialUtils {
@@ -20,7 +19,7 @@ public final class MaterialUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomOre(data); return ModUtils.isCustomOre(data);
} }
} }
} }

View File

@@ -167,7 +167,7 @@ public final class MobHealthbarUtils {
return true; return true;
default: default:
return false; return ModUtils.isCustomBossEntity(livingEntity);
} }
} }
} }

View File

@@ -1,283 +0,0 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.mods.CustomEntity;
import com.gmail.nossr50.datatypes.mods.CustomTool;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ModManager {
private List<Repairable> repairables = new ArrayList<Repairable>();
// Armor Mods
private List<Material> customBoots = new ArrayList<Material>();
private List<Material> customChestplates = new ArrayList<Material>();
private List<Material> customHelmets = new ArrayList<Material>();
private List<Material> customLeggings = new ArrayList<Material>();
// Block Mods
private List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customOres = new ArrayList<MaterialData>();
private List<MaterialData> customLogs = new ArrayList<MaterialData>();
private List<MaterialData> customLeaves = new ArrayList<MaterialData>();
private List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
private HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
// Entity Mods
private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
private HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
// Tool Mods
private List<Material> customAxes = new ArrayList<Material>();
private List<Material> customBows = new ArrayList<Material>();
private List<Material> customHoes = new ArrayList<Material>();
private List<Material> customPickaxes = new ArrayList<Material>();
private List<Material> customShovels = new ArrayList<Material>();
private List<Material> customSwords = new ArrayList<Material>();
private HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
public void registerCustomArmor(CustomArmorConfig config) {
customBoots.addAll(config.customBoots);
customChestplates.addAll(config.customChestplates);
customHelmets.addAll(config.customHelmets);
customLeggings.addAll(config.customLeggings);
repairables.addAll(config.repairables);
}
public void registerCustomBlocks(CustomBlockConfig config) {
customExcavationBlocks.addAll(config.customExcavationBlocks);
customHerbalismBlocks.addAll(config.customHerbalismBlocks);
customMiningBlocks.addAll(config.customMiningBlocks);
customOres.addAll(config.customOres);
customLogs.addAll(config.customLogs);
customLeaves.addAll(config.customLeaves);
customAbilityBlocks.addAll(config.customAbilityBlocks);
customBlockMap.putAll(config.customBlockMap);
}
public void registerCustomEntities(CustomEntityConfig config) {
customEntityClassMap.putAll(config.customEntityClassMap);
customEntityTypeMap.putAll(config.customEntityTypeMap);
}
public void registerCustomTools(CustomToolConfig config) {
customAxes.addAll(config.customAxes);
customBows.addAll(config.customBows);
customHoes.addAll(config.customHoes);
customPickaxes.addAll(config.customPickaxes);
customShovels.addAll(config.customShovels);
customSwords.addAll(config.customSwords);
customToolMap.putAll(config.customToolMap);
repairables.addAll(config.repairables);
}
public boolean isCustomBoots(Material material) {
return Config.getInstance().getArmorModsEnabled() && customBoots.contains(material);
}
public boolean isCustomChestplate(Material material) {
return Config.getInstance().getArmorModsEnabled() && customChestplates.contains(material);
}
public boolean isCustomHelmet(Material material) {
return Config.getInstance().getArmorModsEnabled() && customHelmets.contains(material);
}
public boolean isCustomLeggings(Material material) {
return Config.getInstance().getArmorModsEnabled() && customLeggings.contains(material);
}
public boolean isCustomAxe(Material material) {
return Config.getInstance().getToolModsEnabled() && customAxes.contains(material);
}
public boolean isCustomBow(Material material) {
return Config.getInstance().getToolModsEnabled() && customBows.contains(material);
}
public boolean isCustomHoe(Material material) {
return Config.getInstance().getToolModsEnabled() && customHoes.contains(material);
}
public boolean isCustomPickaxe(Material material) {
return Config.getInstance().getToolModsEnabled() && customPickaxes.contains(material);
}
public boolean isCustomShovel(Material material) {
return Config.getInstance().getToolModsEnabled() && customShovels.contains(material);
}
public boolean isCustomSword(Material material) {
return Config.getInstance().getToolModsEnabled() && customSwords.contains(material);
}
public boolean isCustomOre(MaterialData data) {
return Config.getInstance().getBlockModsEnabled() && customOres.contains(data);
}
public boolean isCustomLog(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customLogs.contains(state.getData());
}
public boolean isCustomLeaf(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customLeaves.contains(state.getData());
}
public boolean isCustomAbilityBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customAbilityBlocks.contains(state.getData());
}
public boolean isCustomExcavationBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customExcavationBlocks.contains(state.getData());
}
public boolean isCustomHerbalismBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customHerbalismBlocks.contains(state.getData());
}
public boolean isCustomMiningBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customMiningBlocks.contains(state.getData());
}
public CustomBlock getBlock(BlockState state) {
return customBlockMap.get(state.getData());
}
public CustomBlock getBlock(MaterialData data) {
return customBlockMap.get(data);
}
/**
* Checks to see if an item is a custom tool.
*
* @param item Item to check
* @return true if the item is a custom tool, false otherwise
*/
public boolean isCustomTool(ItemStack item) {
return Config.getInstance().getToolModsEnabled() && item != null && customToolMap.containsKey(item.getType());
}
/**
* Get the custom tool associated with an item.
*
* @param item The item to check
* @return the tool if it exists, null otherwise
*/
public CustomTool getTool(ItemStack item) {
return item == null ? null : customToolMap.get(item.getType());
}
public List<Repairable> getLoadedRepairables() {
return repairables;
}
public boolean isCustomEntity(Entity entity) {
if (!Config.getInstance().getEntityModsEnabled()) {
return false;
}
if (customEntityTypeMap.containsKey(entity.getType().toString())) {
return true;
}
try {
return customEntityClassMap.containsKey(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
return customEntityClassMap.containsKey(entity.getClass().getName());
}
e.printStackTrace();
return false;
}
}
public CustomEntity getEntity(Entity entity) {
CustomEntity customEntity = customEntityTypeMap.get(entity.getType().toString());
if (customEntity == null) {
try {
customEntity = customEntityClassMap.get(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
customEntity = customEntityClassMap.get(entity.getClass().getName());
}
else {
e.printStackTrace();
}
}
}
return customEntity;
}
public void addCustomEntity(Entity entity) {
if (!Config.getInstance().getEntityModsEnabled()) {
return;
}
File entityFile = new File(mcMMO.p.getDataFolder(), "mods" + File.separator + "entities.default.yml");
YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);
String entityName = entity.getType().toString();
String sanitizedEntityName = entityName.replace(".", "_");
if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
return;
}
entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
entitiesFile.set(sanitizedEntityName + ".Tameable", false);
entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);
String className = "";
try {
className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
className = entity.getClass().getName();
}
else {
e.printStackTrace();
}
}
CustomEntity customEntity = new CustomEntity(1.0D, false, 0, false, null, 0);
customEntityTypeMap.put(entityName, customEntity);
customEntityClassMap.put(className, customEntity);
try {
entitiesFile.save(entityFile);
mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
}
catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,213 @@
package com.gmail.nossr50.util;
import java.io.File;
import org.bukkit.block.BlockState;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.mods.CustomEntity;
import com.gmail.nossr50.datatypes.mods.CustomTool;
public final class ModUtils {
private static boolean customToolsEnabled = Config.getInstance().getToolModsEnabled();
private static boolean customBlocksEnabled = Config.getInstance().getBlockModsEnabled();
private static boolean customEntitiesEnabled = Config.getInstance().getEntityModsEnabled();
private ModUtils() {}
/**
* Get the custom tool associated with an item.
*
* @param item The item to check
* @return the tool if it exists, null otherwise
*/
public static CustomTool getToolFromItemStack(ItemStack item) {
return CustomToolConfig.getInstance().getCustomTool(item.getType());
}
/**
* Get the custom entity associated with an entity.
*
* @param entity The entity to check
* @return the entity is if exists, null otherwise
*/
public static CustomEntity getCustomEntity(Entity entity) {
return CustomEntityConfig.getInstance().getCustomEntity(entity);
}
/**
* Get the custom block associated with an block.
*
* @param blockState The BlockState of the bloc to check
* @return the block if it exists, null otherwise
*/
public static CustomBlock getCustomBlock(BlockState blockState) {
return CustomBlockConfig.getInstance().getCustomBlock(blockState.getData());
}
public static CustomBlock getCustomBlock(MaterialData data) {
return CustomBlockConfig.getInstance().getCustomBlock(data);
}
/**
* Check if a custom block is a woodcutting block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom woodcutting block, false otherwise
*/
public static boolean isCustomWoodcuttingBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomWoodcuttingBlock(blockState.getData());
}
/**
* Check if a custom block should not activate abilites.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents an ability block, false otherwise
*/
public static boolean isCustomAbilityBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomAbilityBlock(blockState.getData());
}
/**
* Check if a custom block is a mining block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom mining block, false otherwise
*/
public static boolean isCustomMiningBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomMiningBlock(blockState.getData());
}
/**
* Check if a custom block is an excavation block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom excavation block, false otherwise
*/
public static boolean isCustomExcavationBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomExcavationBlock(blockState.getData());
}
/**
* Check if a custom block is an herbalism block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom herbalism block, false otherwise
*/
public static boolean isCustomHerbalismBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomHerbalismBlock(blockState.getData());
}
/**
* Check if a custom block is a leaf block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents leaves, false otherwise
*/
public static boolean isCustomLeafBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomLeaf(blockState.getData());
}
/**
* Check if a custom block is a log block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a log, false otherwise
*/
public static boolean isCustomLogBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomLog(blockState.getData());
}
public static boolean isCustomOre(MaterialData data) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomOre(data);
}
/**
* Checks to see if an item is a custom tool.
*
* @param item Item to check
* @return true if the item is a custom tool, false otherwise
*/
public static boolean isCustomTool(ItemStack item) {
return customToolsEnabled && CustomToolConfig.getInstance().isCustomTool(item.getType());
}
/**
* Checks to see if an entity is a custom entity.
*
* @param entity Entity to check
* @return true if the entity is a custom entity, false otherwise
*/
public static boolean isCustomEntity(Entity entity) {
return customEntitiesEnabled && CustomEntityConfig.getInstance().isCustomEntity(entity);
}
/**
* Check if a custom entity is a boss.
*
* @param entity The entity to check
* @return true if the entity represents a boss, false otherwise
*/
public static boolean isCustomBossEntity(Entity entity) {
//TODO: Finish this method
return false;
}
public static void addCustomEntity(Entity entity) {
if (!customEntitiesEnabled) {
return;
}
File entityFile = CustomEntityConfig.getInstance().getFile();
YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);
String entityName = entity.getType().toString();
String sanitizedEntityName = entityName.replace(".", "_");
if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
return;
}
entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
entitiesFile.set(sanitizedEntityName + ".Tameable", false);
entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);
String className = "";
try {
className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
className = entity.getClass().getName();
}
else {
e.printStackTrace();
}
}
CustomEntityConfig.getInstance().addEntity(new CustomEntity(1.0D, false, 0, false, null, 0), className, entityName);
try {
entitiesFile.save(entityFile);
mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
}
catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -20,6 +20,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory; import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
public class HashChunkManager implements ChunkManager { public class HashChunkManager implements ChunkManager {
private static final int FILE_VERSION = 1;
private HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>>(); private HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>>();
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>(); public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>(); public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
@@ -120,7 +121,21 @@ public class HashChunkManager implements ChunkManager {
McMMOSimpleRegionFile regionFile = worldRegions.get(key2); McMMOSimpleRegionFile regionFile = worldRegions.get(key2);
if (regionFile == null) { if (regionFile == null) {
File file = new File(directory, "mcmmo_" + rx + "_" + rz + "_.mcm"); // Pre-Versioned files in negative chunks were being saved/tracked with incorrect chunk numbers
int xLegacy = (x < -1) ? (x + 1) >> 5 : rx;
int zLegacy = (z < -1) ? (z + 1) >> 5 : rz;
File legacy = new File(directory, "mcmmo_" + xLegacy + "_" + zLegacy + "_.mcm");
File file = new File(directory, "mcmmo_" + rx + "_" + rz + "_.v" + FILE_VERSION + ".mcm");
// If the legacy file exists, rename it and the loading will convert it properly
if (legacy.isFile()) {
// The center 4 chunks are unusable so we don't preserve them
if (!((rx == 0 || rx == -1) && (rz == 0 || rz == -1))) {
if (!legacy.renameTo(file)) {
mcMMO.p.debug(String.format("Lost Legacy ChunkStore for %d %d", rx, rz));
}
}
legacy.delete();
}
regionFile = new McMMOSimpleRegionFile(file, rx, rz); regionFile = new McMMOSimpleRegionFile(file, rx, rz);
worldRegions.put(key2, regionFile); worldRegions.put(key2, regionFile);
} }
@@ -293,8 +308,8 @@ public class HashChunkManager implements ChunkManager {
return false; return false;
} }
int cx = x / 16; int cx = (x < 0 ? x - 16 : x) >> 4 << 4;
int cz = z / 16; int cz = (z < 0 ? z - 16 : z) >> 4 << 4;
String key = world.getName() + "," + cx + "," + cz; String key = world.getName() + "," + cx + "," + cz;
if (!store.containsKey(key)) { if (!store.containsKey(key)) {
@@ -336,8 +351,8 @@ public class HashChunkManager implements ChunkManager {
return; return;
} }
int cx = x / 16; int cx = (x < 0 ? x - 16 : x) >> 4 << 4;
int cz = z / 16; int cz = (z < 0 ? z - 16 : z) >> 4 << 4;
int ix = Math.abs(x) % 16; int ix = Math.abs(x) % 16;
int iz = Math.abs(z) % 16; int iz = Math.abs(z) % 16;
@@ -382,8 +397,8 @@ public class HashChunkManager implements ChunkManager {
return; return;
} }
int cx = x / 16; int cx = (x < 0 ? x - 16 : x) >> 4 << 4;
int cz = z / 16; int cz = (z < 0 ? z - 16 : z) >> 4 << 4;
int ix = Math.abs(x) % 16; int ix = Math.abs(x) % 16;
int iz = Math.abs(z) % 16; int iz = Math.abs(z) % 16;

View File

@@ -15,7 +15,7 @@ public class PrimitiveChunkStore implements ChunkStore {
transient private boolean dirty = false; transient private boolean dirty = false;
/** X, Z, Y */ /** X, Z, Y */
public boolean[][][] store; public boolean[][][] store;
private static final int CURRENT_VERSION = 7; private static final int CURRENT_VERSION = 8;
private static final int MAGIC_NUMBER = 0xEA5EDEBB; private static final int MAGIC_NUMBER = 0xEA5EDEBB;
private int cx; private int cx;
private int cz; private int cz;
@@ -132,6 +132,16 @@ public class PrimitiveChunkStore implements ChunkStore {
fixArray(); fixArray();
dirty = true; dirty = true;
} }
if (fileVersionNumber == 7 && cx < 0) {
cx--;
dirty = true;
}
if (fileVersionNumber == 7 && cz < 0) {
cz--;
dirty = true;
}
} }
private void fixArray() { private void fixArray() {

View File

@@ -191,10 +191,10 @@ public final class CommandUtils {
public static String displaySkill(PlayerProfile profile, SkillType skill) { public static String displaySkill(PlayerProfile profile, SkillType skill) {
if (skill.isChildSkill()) { if (skill.isChildSkill()) {
return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill)); return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), " ", profile.getSkillLevel(skill));
} }
return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill)); return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
} }
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<SkillType> skillGroup) { private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<SkillType> skillGroup) {

View File

@@ -39,6 +39,7 @@ import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.MobHealthbarUtils; import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@@ -420,8 +421,8 @@ public final class CombatUtils {
} }
} }
else { else {
if (mcMMO.getModManager().isCustomEntity(target)) { if (ModUtils.isCustomEntity(target)) {
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier(); baseXP = ModUtils.getCustomEntity(target).getXpMultiplier();
} }
else if (target instanceof Animals) { else if (target instanceof Animals) {
baseXP = ExperienceConfig.getInstance().getAnimalsXP(); baseXP = ExperienceConfig.getInstance().getAnimalsXP();
@@ -472,7 +473,7 @@ public final class CombatUtils {
default: default:
baseXP = 1.0; baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target); ModUtils.addCustomEntity(target);
break; break;
} }
} }
@@ -608,8 +609,8 @@ public final class CombatUtils {
else if (ItemUtils.isDiamondTool(inHand)) { else if (ItemUtils.isDiamondTool(inHand)) {
tier = 4; tier = 4;
} }
else if (mcMMO.getModManager().isCustomTool(inHand)) { else if (ModUtils.isCustomTool(inHand)) {
tier = mcMMO.getModManager().getTool(inHand).getTier(); tier = ModUtils.getToolFromItemStack(inHand).getTier();
} }
return tier; return tier;

View File

@@ -66,7 +66,7 @@ Potions:
0: # Water Bottle 0: # Water Bottle
Children: Children:
BLAZE_POWDER: 8192 # Mundane Potion BLAZE_POWDER: 8192 # Mundane Potion
FERMENTED_SPIDER_EYE: 8200 # Potion of Weakness FERMENTED_SPIDER_EYE: 4616 # Potion of Weakness
GHAST_TEAR: 8192 # Mundane Potion GHAST_TEAR: 8192 # Mundane Potion
GLOWSTONE_DUST: 32 # Thick Potion GLOWSTONE_DUST: 32 # Thick Potion
MAGMA_CREAM: 8192 # Mundane Potion MAGMA_CREAM: 8192 # Mundane Potion
@@ -79,72 +79,73 @@ Potions:
16: # Awkward Potion 16: # Awkward Potion
Children: Children:
APPLE: 5376 # Potion of Health Boost APPLE: 5376 # Potion of Health Boost
BLAZE_POWDER: 8201 # Potion of Strength BLAZE_POWDER: 1289 # Potion of Strength
BROWN_MUSHROOM: 2304 # Potion of Nausea BROWN_MUSHROOM: 2304 # Potion of Nausea
CARROT_ITEM: 768 # Potion of Haste CARROT_ITEM: 768 # Potion of Haste
FERMENTED_SPIDER_EYE: 8200 # Potion of Weakness FERMENTED_SPIDER_EYE: 4616 # Potion of Weakness
GHAST_TEAR: 8193 # Potion of Regeneration GHAST_TEAR: 2561 # Potion of Regeneration
'GOLDEN_APPLE:0': 2816 # Potion of Resistance 'GOLDEN_APPLE:0': 2816 # Potion of Resistance
GOLDEN_CARROT: 8198 # Potion of Night Vision GOLDEN_CARROT: 4102 # Potion of Night Vision
'INK_SACK:0': 3840 # Potion of Blindness 'INK_SACK:0': 3840 # Potion of Blindness
'LONG_GRASS:2': 5888 # Potion of Saturation 'LONG_GRASS:2': 5888 # Potion of Saturation
MAGMA_CREAM: 8195 # Potion of Fire Resistance MAGMA_CREAM: 3075 # Potion of Fire Resistance
POISONOUS_POTATO: 5120 # Potion of Decay POISONOUS_POTATO: 5120 # Potion of Decay
QUARTZ: 5632 # Potion of Absorption QUARTZ: 5632 # Potion of Absorption
RED_MUSHROOM: 2048 # Potion of Leaping RED_MUSHROOM: 2048 # Potion of Leaping
ROTTEN_FLESH: 4352 # Potion of Hunger ROTTEN_FLESH: 4352 # Potion of Hunger
SLIME_BALL: 1024 # Potion of Dullness SLIME_BALL: 1024 # Potion of Dullness
SPECKLED_MELON: 8197 # Potion of Healing SPECKLED_MELON: 1541 # Potion of Healing
SPIDER_EYE: 8196 # Potion of Poison SPIDER_EYE: 4868 # Potion of Poison
SUGAR: 8194 # Potion of Swiftness SUGAR: 258 # Potion of Swiftness
WATER_LILY: 8205 # Potion of Water Breathing (Minecraft 1.6) WATER_LILY: 3341 # Potion of Water Breathing (Minecraft 1.6)
'RAW_FISH:3': 8205 # Potion of Water Breathing (Minecraft 1.7) 'RAW_FISH:3': 3341 # Potion of Water Breathing (Minecraft 1.7)
32: # Thick Potion 32: # Thick Potion
Children: Children:
FERMENTED_SPIDER_EYE: 8200 FERMENTED_SPIDER_EYE: 4616
64: # Mundane Potion Extended 64: # Mundane Potion Extended
Children: Children:
FERMENTED_SPIDER_EYE: 8264 FERMENTED_SPIDER_EYE: 4680
8192: # Mundane Potion 8192: # Mundane Potion
Children: Children:
FERMENTED_SPIDER_EYE: 8200 FERMENTED_SPIDER_EYE: 4616
SULPHUR: 16384 SULPHUR: 16384
### DRINKABLE POTIONS ###################################################### ### DRINKABLE POTIONS ######################################################
8194: # Potion of Swiftness 258: # Potion of Swiftness
Effects: ["SPEED 0 3600"] Effects: ["SPEED 0 3600"]
Children: Children:
FERMENTED_SPIDER_EYE: 8202 FERMENTED_SPIDER_EYE: 522
GLOWSTONE_DUST: 8226 GLOWSTONE_DUST: 290
REDSTONE: 8258 REDSTONE: 322
SULPHUR: 16386 SULPHUR: 16642
8226: # Potion of Swiftness II 290: # Potion of Swiftness II
Effects: ["SPEED 1 1800"] Effects: ["SPEED 1 1800"]
Children: Children:
FERMENTED_SPIDER_EYE: 8266 FERMENTED_SPIDER_EYE: 586
REDSTONE: 8258 REDSTONE: 322
SULPHUR: 16418 SULPHUR: 16642
8258: # Potion of Swiftness Extended 322: # Potion of Swiftness Extended
Effects: ["SPEED 0 9600"] Effects: ["SPEED 0 9600"]
Children: Children:
FERMENTED_SPIDER_EYE: 8202 FERMENTED_SPIDER_EYE: 522
GLOWSTONE_DUST: 8226 GLOWSTONE_DUST: 290
SULPHUR: 16450 SULPHUR: 16706
8202: # Potion of Slowness 522: # Potion of Slowness
Effects: ["SLOW 0 1800"] Effects: ["SLOW 0 1800"]
Children: Children:
REDSTONE: 8266 REDSTONE: 586
SULPHUR: 16394 SULPHUR: 16906
8266: # Potion of Slowness Extended 586: # Potion of Slowness Extended
Effects: ["SLOW 0 4800"] Effects: ["SLOW 0 4800"]
Children: Children:
GLOWSTONE_DUST: 8202 GLOWSTONE_DUST: 522
SULPHUR: 16458 SULPHUR: 16970
768: # Potion of Haste 768: # Potion of Haste
Effects: ["FAST_DIGGING 0 3600"] Effects: ["FAST_DIGGING 0 3600"]
@@ -182,49 +183,49 @@ Potions:
GLOWSTONE_DUST: 1056 GLOWSTONE_DUST: 1056
SULPHUR: 17472 SULPHUR: 17472
8201: # Potion of Strength 1289: # Potion of Strength
Effects: ["INCREASE_DAMAGE 0 3600"] Effects: ["INCREASE_DAMAGE 0 3600"]
Children: Children:
FERMENTED_SPIDER_EYE: 8200 FERMENTED_SPIDER_EYE: 4616
GLOWSTONE_DUST: 8233 GLOWSTONE_DUST: 1321
REDSTONE: 8265 REDSTONE: 1353
SULPHUR: 16393 SULPHUR: 17673
8233: # Potion of Strength II 1321: # Potion of Strength II
Effects: ["INCREASE_DAMAGE 1 1800"] Effects: ["INCREASE_DAMAGE 1 1800"]
Children: Children:
FERMENTED_SPIDER_EYE: 8200 FERMENTED_SPIDER_EYE: 4616
REDSTONE: 8265 REDSTONE: 1353
SULPHUR: 16425 SULPHUR: 17705
8265: # Potion of Strength Extended 1353: # Potion of Strength Extended
Effects: ["INCREASE_DAMAGE 0 9600"] Effects: ["INCREASE_DAMAGE 0 9600"]
Children: Children:
FERMENTED_SPIDER_EYE: 8264 FERMENTED_SPIDER_EYE: 4680
GLOWSTONE_DUST: 8233 GLOWSTONE_DUST: 1321
SULPHUR: 16457 SULPHUR: 17737
8197: # Potion of Healing 1541: # Potion of Healing
Effects: ["HEAL 0"] Effects: ["HEAL 0"]
Children: Children:
FERMENTED_SPIDER_EYE: 8204 FERMENTED_SPIDER_EYE: 1804
GLOWSTONE_DUST: 8229 GLOWSTONE_DUST: 1573
SULPHUR: 16389 SULPHUR: 17925
8229: # Potion of Healing II 1573: # Potion of Healing II
Effects: ["HEAL 1"] Effects: ["HEAL 1"]
Children: Children:
FERMENTED_SPIDER_EYE: 8236 FERMENTED_SPIDER_EYE: 1836
REDSTONE: 8197 REDSTONE: 1541
SULPHUR: 16421 SULPHUR: 17957
8204: # Potion of Harming 1804: # Potion of Harming
Effects: ["HARM 0"] Effects: ["HARM 0"]
Children: Children:
GLOWSTONE_DUST: 8236 GLOWSTONE_DUST: 1836
SULPHUR: 16396 SULPHUR: 18188
8236: # Potion of Harming II 1836: # Potion of Harming II
Effects: ["HARM 1"] Effects: ["HARM 1"]
Children: Children:
REDSTONE: 8204 REDSTONE: 1804
SULPHUR: 16428 SULPHUR: 18220
2048: # Potion of Leaping 2048: # Potion of Leaping
Effects: ["JUMP 0 3600"] Effects: ["JUMP 0 3600"]
@@ -254,25 +255,25 @@ Potions:
GLOWSTONE_DUST: 2304 GLOWSTONE_DUST: 2304
SULPHUR: 18752 SULPHUR: 18752
8193: # Potion of Regeneration 2561: # Potion of Regeneration
Effects: ["REGENERATION 0 900"] Effects: ["REGENERATION 0 900"]
Children: Children:
FERMENTED_SPIDER_EYE: 8200 FERMENTED_SPIDER_EYE: 4616
GLOWSTONE_DUST: 8225 GLOWSTONE_DUST: 2593
REDSTONE: 8257 REDSTONE: 2625
SULPHUR: 16385 SULPHUR: 18945
8225: # Potion of Regeneration II 2593: # Potion of Regeneration II
Effects: ["REGENERATION 1 450"] Effects: ["REGENERATION 1 450"]
Children: Children:
FERMENTED_SPIDER_EYE: 8200 FERMENTED_SPIDER_EYE: 4616
REDSTONE: 8257 REDSTONE: 2625
SULPHUR: 16417 SULPHUR: 18977
8257: # Potion of Regeneration Extended 2625: # Potion of Regeneration Extended
Effects: ["REGENERATION 0 2400"] Effects: ["REGENERATION 0 2400"]
Children: Children:
FERMENTED_SPIDER_EYE: 8264 FERMENTED_SPIDER_EYE: 4680
GLOWSTONE_DUST: 8225 GLOWSTONE_DUST: 2593
SULPHUR: 16449 SULPHUR: 19009
2816: # Potion of Resistance 2816: # Potion of Resistance
Effects: ["DAMAGE_RESISTANCE 0 450"] Effects: ["DAMAGE_RESISTANCE 0 450"]
@@ -291,40 +292,40 @@ Potions:
GLOWSTONE_DUST: 2848 GLOWSTONE_DUST: 2848
SULPHUR: 19264 SULPHUR: 19264
8195: # Potion of Fire Resistance 3075: # Potion of Fire Resistance
Effects: ["FIRE_RESISTANCE 0 3600"] Effects: ["FIRE_RESISTANCE 0 3600"]
Children: Children:
FERMENTED_SPIDER_EYE: 8202 FERMENTED_SPIDER_EYE: 522
REDSTONE: 3139 REDSTONE: 3139
SULPHUR: 16387 SULPHUR: 19459
3139: # Potion of Fire Resistance Extended 3139: # Potion of Fire Resistance Extended
Effects: ["FIRE_RESISTANCE 0 9600"] Effects: ["FIRE_RESISTANCE 0 9600"]
Children: Children:
FERMENTED_SPIDER_EYE: 8266 FERMENTED_SPIDER_EYE: 586
GLOWSTONE_DUST: 8195 GLOWSTONE_DUST: 3075
SULPHUR: 16451 SULPHUR: 19523
8205: # Potion of Water Breathing 3341: # Potion of Water Breathing
Effects: ["WATER_BREATHING 0 3600"] Effects: ["WATER_BREATHING 0 3600"]
Children: Children:
REDSTONE: 3405 REDSTONE: 3405
SULPHUR: 16397 SULPHUR: 19725
3405: # Potion of Water Breathing Extended 3405: # Potion of Water Breathing Extended
Effects: ["WATER_BREATHING 0 9600"] Effects: ["WATER_BREATHING 0 9600"]
Children: Children:
GLOWSTONE_DUST: 8205 GLOWSTONE_DUST: 3341
SULPHUR: 16461 SULPHUR: 19789
3598: # Potion of Invisibility 3598: # Potion of Invisibility
Effects: ["INVISIBILITY 0 3600"] Effects: ["INVISIBILITY 0 3600"]
Children: Children:
REDSTONE: 3662 REDSTONE: 3662
SULPHUR: 16398 SULPHUR: 19982
3662: # Potion of Invisibility Extended 3662: # Potion of Invisibility Extended
Effects: ["INVISIBILITY 0 9600"] Effects: ["INVISIBILITY 0 9600"]
Children: Children:
GLOWSTONE_DUST: 3598 GLOWSTONE_DUST: 3598
SULPHUR: 16462 SULPHUR: 20046
3840: # Potion of Blindness 3840: # Potion of Blindness
Effects: ["BLINDNESS 0 225"] Effects: ["BLINDNESS 0 225"]
@@ -337,18 +338,18 @@ Potions:
GLOWSTONE_DUST: 3840 GLOWSTONE_DUST: 3840
SULPHUR: 20288 SULPHUR: 20288
8198: # Potion of Night Vision 4102: # Potion of Night Vision
Effects: ["NIGHT_VISION 0 3600"] Effects: ["NIGHT_VISION 0 3600"]
Children: Children:
FERMENTED_SPIDER_EYE: 3598 FERMENTED_SPIDER_EYE: 3598
REDSTONE: 4166 REDSTONE: 4166
SULPHUR: 16390 SULPHUR: 20486
4166: # Potion of Night Vision Extended 4166: # Potion of Night Vision Extended
Effects: ["NIGHT_VISION 0 9600"] Effects: ["NIGHT_VISION 0 9600"]
Children: Children:
FERMENTED_SPIDER_EYE: 3662 FERMENTED_SPIDER_EYE: 3662
GLOWSTONE_DUST: 8198 GLOWSTONE_DUST: 4102
SULPHUR: 16454 SULPHUR: 20550
4352: # Potion of Hunger 4352: # Potion of Hunger
Effects: ["HUNGER 0 900"] Effects: ["HUNGER 0 900"]
@@ -367,36 +368,36 @@ Potions:
GLOWSTONE_DUST: 4384 GLOWSTONE_DUST: 4384
SULPHUR: 20800 SULPHUR: 20800
8200: # Potion of Weakness 4616: # Potion of Weakness
Effects: ["WEAKNESS 0 1800"] Effects: ["WEAKNESS 0 1800"]
Children: Children:
REDSTONE: 8264 REDSTONE: 4680
SULPHUR: 16392 SULPHUR: 21000
8264: # Potion of Weakness Extended 4680: # Potion of Weakness Extended
Effects: ["WEAKNESS 0 4800"] Effects: ["WEAKNESS 0 4800"]
Children: Children:
GLOWSTONE_DUST: 8200 GLOWSTONE_DUST: 4616
SULPHUR: 16456 SULPHUR: 21064
8196: # Potion of Poison 4868: # Potion of Poison
Effects: ["POISON 0 900"] Effects: ["POISON 0 900"]
Children: Children:
FERMENTED_SPIDER_EYE: 8204 FERMENTED_SPIDER_EYE: 1804
GLOWSTONE_DUST: 8228 GLOWSTONE_DUST: 4900
REDSTONE: 8260 REDSTONE: 4932
SULPHUR: 16388 SULPHUR: 21252
8228: # Potion of Poison II 4900: # Potion of Poison II
Effects: ["POISON 1 450"] Effects: ["POISON 1 450"]
Children: Children:
FERMENTED_SPIDER_EYE: 8236 FERMENTED_SPIDER_EYE: 1836
REDSTONE: 8260 REDSTONE: 4932
SULPHUR: 16452 SULPHUR: 21284
8260: # Potion of Poison Extended 4932: # Potion of Poison Extended
Effects: ["POISON 0 2400"] Effects: ["POISON 0 2400"]
Children: Children:
FERMENTED_SPIDER_EYE: 8204 FERMENTED_SPIDER_EYE: 1804
GLOWSTONE_DUST: 8228 GLOWSTONE_DUST: 4900
SULPHUR: 16452 SULPHUR: 21284
5120: # Potion of Decay 5120: # Potion of Decay
Effects: ["WITHER 0 450"] Effects: ["WITHER 0 450"]
@@ -464,33 +465,33 @@ Potions:
16384: # Splash Mundane Potion 16384: # Splash Mundane Potion
Children: Children:
FERMENTED_SPIDER_EYE: 16392 FERMENTED_SPIDER_EYE: 21000
16386: # Splash Potion of Swiftness 16642: # Splash Potion of Swiftness
Effects: ["SPEED 0 2700"] Effects: ["SPEED 0 2700"]
Children: Children:
FERMENTED_SPIDER_EYE: 16394 FERMENTED_SPIDER_EYE: 16906
GLOWSTONE_DUST: 16418 GLOWSTONE_DUST: 16674
REDSTONE: 16450 REDSTONE: 16706
16418: # Splash Potion of Swiftness II 16674: # Splash Potion of Swiftness II
Effects: ["SPEED 1 1350"] Effects: ["SPEED 1 1350"]
Children: Children:
FERMENTED_SPIDER_EYE: 16394 FERMENTED_SPIDER_EYE: 16906
REDSTONE: 16450 REDSTONE: 16706
16450: # Splash Potion of Swiftness Extended 16706: # Splash Potion of Swiftness Extended
Effects: ["SPEED 0 7200"] Effects: ["SPEED 0 7200"]
Children: Children:
FERMENTED_SPIDER_EYE: 16394 FERMENTED_SPIDER_EYE: 16906
GLOWSTONE_DUST: 16418 GLOWSTONE_DUST: 16674
16394: # Splash Potion of Slowness 16906: # Splash Potion of Slowness
Effects: ["SLOW 0 1350"] Effects: ["SLOW 0 1350"]
Children: Children:
REDSTONE: 16458 REDSTONE: 16970
16458: # Splash Potion of Slowness Extended 16970: # Splash Potion of Slowness Extended
Effects: ["SLOW 0 3600"] Effects: ["SLOW 0 3600"]
Children: Children:
GLOWSTONE_DUST: 16394 GLOWSTONE_DUST: 16906
17152: # Splash Potion of Haste 17152: # Splash Potion of Haste
Effects: ["FAST_DIGGING 0 2700"] Effects: ["FAST_DIGGING 0 2700"]
@@ -520,42 +521,42 @@ Potions:
Children: Children:
GLOWSTONE_DUST: 17440 GLOWSTONE_DUST: 17440
16393: # Splash Potion of Strength 17673: # Splash Potion of Strength
Effects: ["INCREASE_DAMAGE 0 2700"] Effects: ["INCREASE_DAMAGE 0 2700"]
Children: Children:
FERMENTED_SPIDER_EYE: 16392 FERMENTED_SPIDER_EYE: 21000
GLOWSTONE_DUST: 16425 GLOWSTONE_DUST: 17705
REDSTONE: 16457 REDSTONE: 17737
16425: # Splash Potion of Strength II 17705: # Splash Potion of Strength II
Effects: ["INCREASE_DAMAGE 1 1350"] Effects: ["INCREASE_DAMAGE 1 1350"]
Children: Children:
FERMENTED_SPIDER_EYE: 16392 FERMENTED_SPIDER_EYE: 21000
REDSTONE: 16457 REDSTONE: 17737
16457: # Splash Potion of Strength Extended 17737: # Splash Potion of Strength Extended
Effects: ["INCREASE_DAMAGE 0 7200"] Effects: ["INCREASE_DAMAGE 0 7200"]
Children: Children:
FERMENTED_SPIDER_EYE: 16456 FERMENTED_SPIDER_EYE: 21064
GLOWSTONE_DUST: 16425 GLOWSTONE_DUST: 17705
16389: # Splash Potion of Healing 17925: # Splash Potion of Healing
Effects: ["HEAL 0"] Effects: ["HEAL 0"]
Children: Children:
FERMENTED_SPIDER_EYE: 16396 FERMENTED_SPIDER_EYE: 18188
GLOWSTONE_DUST: 16421 GLOWSTONE_DUST: 17957
16421: # Splash Potion of Healing II 17957: # Splash Potion of Healing II
Effects: ["HEAL 1"] Effects: ["HEAL 1"]
Children: Children:
FERMENTED_SPIDER_EYE: 16428 FERMENTED_SPIDER_EYE: 18220
REDSTONE: 16389 REDSTONE: 17925
16396: # Splash Potion of Harming 18188: # Splash Potion of Harming
Effects: ["HARM 0"] Effects: ["HARM 0"]
Children: Children:
GLOWSTONE_DUST: 16428 GLOWSTONE_DUST: 18220
16428: # Splash Potion of Harming II 18220: # Splash Potion of Harming II
Effects: ["HARM 1"] Effects: ["HARM 1"]
Children: Children:
REDSTONE: 16396 REDSTONE: 18188
18432: # Splash Potion of Leaping 18432: # Splash Potion of Leaping
Effects: ["JUMP 0 2700"] Effects: ["JUMP 0 2700"]
@@ -580,22 +581,22 @@ Potions:
Children: Children:
GLOWSTONE_DUST: 18688 GLOWSTONE_DUST: 18688
16385: # Splash Potion of Regeneration 18945: # Splash Potion of Regeneration
Effects: ["REGENERATION 0 675"] Effects: ["REGENERATION 0 675"]
Children: Children:
FERMENTED_SPIDER_EYE: 16392 FERMENTED_SPIDER_EYE: 21000
GLOWSTONE_DUST: 16417 GLOWSTONE_DUST: 18977
REDSTONE: 16449 REDSTONE: 19009
16417: # Splash Potion of Regeneration II 18977: # Splash Potion of Regeneration II
Effects: ["REGENERATION 1 338"] Effects: ["REGENERATION 1 338"]
Children: Children:
FERMENTED_SPIDER_EYE: 16392 FERMENTED_SPIDER_EYE: 21000
REDSTONE: 16449 REDSTONE: 19009
16449: # Splash Potion of Regeneration Extended 19009: # Splash Potion of Regeneration Extended
Effects: ["REGENERATION 0 1800"] Effects: ["REGENERATION 0 1800"]
Children: Children:
FERMENTED_SPIDER_EYE: 16456 FERMENTED_SPIDER_EYE: 21064
GLOWSTONE_DUST: 16417 GLOWSTONE_DUST: 18977
19200: # Splash Potion of Resistance 19200: # Splash Potion of Resistance
Effects: ["DAMAGE_RESISTANCE 0 338"] Effects: ["DAMAGE_RESISTANCE 0 338"]
@@ -611,34 +612,34 @@ Potions:
Children: Children:
GLOWSTONE_DUST: 19232 GLOWSTONE_DUST: 19232
16387: # Splash Potion of Fire Resistance 19459: # Splash Potion of Fire Resistance
Effects: ["FIRE_RESISTANCE 0 2700"] Effects: ["FIRE_RESISTANCE 0 2700"]
Children: Children:
FERMENTED_SPIDER_EYE: 16394 FERMENTED_SPIDER_EYE: 16906
REDSTONE: 16451 REDSTONE: 19523
16451: # Splash Potion of Fire Resistance Extended 19523: # Splash Potion of Fire Resistance Extended
Effects: ["FIRE_RESISTANCE 0 7200"] Effects: ["FIRE_RESISTANCE 0 7200"]
Children: Children:
FERMENTED_SPIDER_EYE: 16458 FERMENTED_SPIDER_EYE: 16970
GLOWSTONE_DUST: 16387 GLOWSTONE_DUST: 19459
16397: # Splash Potion of Water Breathing 19725: # Splash Potion of Water Breathing
Effects: ["WATER_BREATHING 0 2700"] Effects: ["WATER_BREATHING 0 2700"]
Children: Children:
REDSTONE: 16461 REDSTONE: 19789
16461: # Splash Potion of Water Breathing Extended 19789: # Splash Potion of Water Breathing Extended
Effects: ["WATER_BREATHING 0 7200"] Effects: ["WATER_BREATHING 0 7200"]
Children: Children:
GLOWSTONE_DUST: 16397 GLOWSTONE_DUST: 19725
16398: # Splash Potion of Invisibility 19982: # Splash Potion of Invisibility
Effects: ["INVISIBILITY 0 2700"] Effects: ["INVISIBILITY 0 2700"]
Children: Children:
REDSTONE: 16462 REDSTONE: 20046
16462: # Splash Potion of Invisibility Extended 20046: # Splash Potion of Invisibility Extended
Effects: ["INVISIBILITY 0 7200"] Effects: ["INVISIBILITY 0 7200"]
Children: Children:
GLOWSTONE_DUST: 16398 GLOWSTONE_DUST: 19982
20224: # Splash Potion of Blindness 20224: # Splash Potion of Blindness
Effects: ["BLINDNESS 0 169"] Effects: ["BLINDNESS 0 169"]
@@ -649,16 +650,16 @@ Potions:
Children: Children:
GLOWSTONE_DUST: 20224 GLOWSTONE_DUST: 20224
16390: # Splash Potion of Night Vision 20486: # Splash Potion of Night Vision
Effects: ["NIGHT_VISION 0 2700"] Effects: ["NIGHT_VISION 0 2700"]
Children: Children:
FERMENTED_SPIDER_EYE: 16398 FERMENTED_SPIDER_EYE: 19982
REDSTONE: 16454 REDSTONE: 20550
16454: # Splash Potion of Night Vision Extended 20550: # Splash Potion of Night Vision Extended
Effects: ["NIGHT_VISION 0 7200"] Effects: ["NIGHT_VISION 0 7200"]
Children: Children:
FERMENTED_SPIDER_EYE: 16462 FERMENTED_SPIDER_EYE: 20046
GLOWSTONE_DUST: 16390 GLOWSTONE_DUST: 20486
20736: # Splash Potion of Hunger 20736: # Splash Potion of Hunger
Effects: ["HUNGER 0 675"] Effects: ["HUNGER 0 675"]
@@ -674,31 +675,31 @@ Potions:
Children: Children:
GLOWSTONE_DUST: 20768 GLOWSTONE_DUST: 20768
16392: # Splash Potion of Weakness 21000: # Splash Potion of Weakness
Effects: ["WEAKNESS 0 1350"] Effects: ["WEAKNESS 0 1350"]
Children: Children:
REDSTONE: 16456 REDSTONE: 21064
16456: # Splash Potion of Weakness Extended 21064: # Splash Potion of Weakness Extended
Effects: ["WEAKNESS 0 3600"] Effects: ["WEAKNESS 0 3600"]
Children: Children:
GLOWSTONE_DUST: 16392 GLOWSTONE_DUST: 21000
16388: # Splash Potion of Poison 21252: # Splash Potion of Poison
Effects: ["POISON 0 675"] Effects: ["POISON 0 675"]
Children: Children:
FERMENTED_SPIDER_EYE: 16396 FERMENTED_SPIDER_EYE: 18188
GLOWSTONE_DUST: 16452 GLOWSTONE_DUST: 21284
REDSTONE: 16452 REDSTONE: 21316
16452: # Splash Potion of Poison II 21284: # Splash Potion of Poison II
Effects: ["POISON 1 338"] Effects: ["POISON 1 338"]
Children: Children:
FERMENTED_SPIDER_EYE: 16428 FERMENTED_SPIDER_EYE: 18220
REDSTONE: 16452 REDSTONE: 21316
16452: # Splash Potion of Poison Extended 21316: # Splash Potion of Poison Extended
Effects: ["POISON 0 1800"] Effects: ["POISON 0 1800"]
Children: Children:
FERMENTED_SPIDER_EYE: 16396 FERMENTED_SPIDER_EYE: 18188
GLOWSTONE_DUST: 16452 GLOWSTONE_DUST: 21284
21504: # Splash Potion of Decay 21504: # Splash Potion of Decay
Effects: ["WITHER 0 338"] Effects: ["WITHER 0 338"]