mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Worlds config beta
This commit is contained in:
parent
2ee919b51f
commit
fc935ce9dd
49
src/main/java/com/gmail/nossr50/config/WorldConfig.java
Normal file
49
src/main/java/com/gmail/nossr50/config/WorldConfig.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
|
public class WorldConfig extends ConfigLoader {
|
||||||
|
|
||||||
|
private static WorldConfig instance;
|
||||||
|
|
||||||
|
public WorldConfig() {
|
||||||
|
super("worlds.yml");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadKeys() { }
|
||||||
|
|
||||||
|
public static WorldConfig getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new WorldConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// World settings
|
||||||
|
public boolean isSkillEnabled(SkillType skillType, String world) {
|
||||||
|
String skill = StringUtils.getCapitalized(skillType.toString());
|
||||||
|
return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".Skills." + skill + ".Enabled", isSkillEnabled(skill));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAbilityEnabled(SkillType skillType, String world) {
|
||||||
|
String skill = StringUtils.getCapitalized(skillType.toString());
|
||||||
|
return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".Skills." + skill + ".AbilityEnabled", isAbilityEnabled(skill));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBlockStoreEnabled(String world) { return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".BlockStore", isBlockStoreEnabled()); }
|
||||||
|
|
||||||
|
public boolean isMobHealthEnabled(String world) { return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".MobHealthBar", isMobHealthEnabled()); }
|
||||||
|
|
||||||
|
// Default settings
|
||||||
|
private boolean isSkillEnabled(String skill) { return config.getBoolean("Worlds.default.Skills." + skill + ".Enabled", true); }
|
||||||
|
|
||||||
|
private boolean isAbilityEnabled(String skill) { return config.getBoolean("Worlds.default.Skills." + skill + ".AbilityEnabled", true); }
|
||||||
|
|
||||||
|
private boolean isBlockStoreEnabled() { return config.getBoolean("Worlds.default.BlockStore", true); }
|
||||||
|
|
||||||
|
private boolean isMobHealthEnabled() { return config.getBoolean("Worlds.default.MobHealthBar", true); }
|
||||||
|
}
|
@ -22,6 +22,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
|
import com.gmail.nossr50.config.WorldConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
@ -58,6 +59,10 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||||
|
if (!WorldConfig.getInstance().isBlockStoreEnabled(event.getBlock().getWorld().getName()) || !HiddenConfig.getInstance().getChunkletsEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<Block> blocks = event.getBlocks();
|
List<Block> blocks = event.getBlocks();
|
||||||
BlockFace direction = event.getDirection();
|
BlockFace direction = event.getDirection();
|
||||||
Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished
|
Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished
|
||||||
@ -88,6 +93,10 @@ public class BlockListener implements Listener {
|
|||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
if (event.isSticky()) {
|
if (event.isSticky()) {
|
||||||
// Needed only because under some circumstances Minecraft doesn't move the block
|
// Needed only because under some circumstances Minecraft doesn't move the block
|
||||||
|
if (!WorldConfig.getInstance().isBlockStoreEnabled(event.getBlock().getWorld().getName()) || !HiddenConfig.getInstance().getChunkletsEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new StickyPistonTrackerTask(event.getDirection(), event.getBlock()).runTaskLater(plugin, 2);
|
new StickyPistonTrackerTask(event.getDirection(), event.getBlock()).runTaskLater(plugin, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,6 +155,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/* HERBALISM */
|
/* HERBALISM */
|
||||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, blockState.getWorld().getName())) {
|
||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
@ -154,22 +164,29 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't check the block store here because herbalism has too many unusual edge cases.
|
* We don't check the block store here because Herbalism has too many unusual edge cases.
|
||||||
* Instead, we check it inside the drops handler.
|
* Instead, we check it inside the drops handler.
|
||||||
*/
|
*/
|
||||||
if (Permissions.skillEnabled(player, SkillType.HERBALISM)) {
|
if (Permissions.skillEnabled(player, SkillType.HERBALISM)) {
|
||||||
herbalismManager.herbalismBlockCheck(blockState);
|
herbalismManager.herbalismBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* MINING */
|
/* MINING */
|
||||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
else if (BlockUtils.affectedBySuperBreaker(blockState)) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, blockState.getWorld().getName())) {
|
||||||
|
if (ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||||
miningManager.miningBlockCheck(blockState);
|
miningManager.miningBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* WOOD CUTTING */
|
/* WOOD CUTTING */
|
||||||
else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
else if (BlockUtils.isLog(blockState)) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.WOODCUTTING, blockState.getWorld().getName())) {
|
||||||
|
if (Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||||
|
|
||||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||||
@ -179,9 +196,13 @@ public class BlockListener implements Listener {
|
|||||||
woodcuttingManager.woodcuttingBlockCheck(blockState);
|
woodcuttingManager.woodcuttingBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* EXCAVATION */
|
/* EXCAVATION */
|
||||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
else if (BlockUtils.affectedByGigaDrillBreaker(blockState)) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.EXCAVATION, blockState.getWorld().getName())) {
|
||||||
|
if (ItemUtils.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||||
excavationManager.excavationBlockCheck(blockState);
|
excavationManager.excavationBlockCheck(blockState);
|
||||||
|
|
||||||
@ -189,6 +210,8 @@ public class BlockListener implements Listener {
|
|||||||
excavationManager.gigaDrillBreaker(blockState);
|
excavationManager.gigaDrillBreaker(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove metadata from placed watched blocks */
|
/* Remove metadata from placed watched blocks */
|
||||||
mcMMO.getPlaceStore().setFalse(blockState);
|
mcMMO.getPlaceStore().setFalse(blockState);
|
||||||
@ -215,6 +238,10 @@ public class BlockListener implements Listener {
|
|||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
if (ItemUtils.isSword(heldItem)) {
|
if (ItemUtils.isSword(heldItem)) {
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, blockState.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HerbalismManager herbalismManager = UserManager.getPlayer(player).getHerbalismManager();
|
HerbalismManager herbalismManager = UserManager.getPlayer(player).getHerbalismManager();
|
||||||
|
|
||||||
if (herbalismManager.canUseHylianLuck()) {
|
if (herbalismManager.canUseHylianLuck()) {
|
||||||
@ -225,6 +252,10 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) {
|
else if (ItemUtils.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, blockState.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();
|
SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();
|
||||||
|
|
||||||
if (smeltingManager.canUseFluxMining(blockState)) {
|
if (smeltingManager.canUseFluxMining(blockState)) {
|
||||||
|
@ -33,7 +33,9 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
import com.gmail.nossr50.config.WorldConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
@ -59,6 +61,9 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.ARCHERY, event.getEntity().getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ItemStack bow = event.getBow();
|
ItemStack bow = event.getBow();
|
||||||
|
|
||||||
if (bow != null) {
|
if (bow != null) {
|
||||||
@ -194,6 +199,10 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
switch (cause) {
|
switch (cause) {
|
||||||
case FALL:
|
case FALL:
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.ACROBATICS, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||||
|
|
||||||
if (acrobaticsManager.canRoll()) {
|
if (acrobaticsManager.canRoll()) {
|
||||||
@ -207,6 +216,10 @@ public class EntityListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_EXPLOSION:
|
case BLOCK_EXPLOSION:
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||||
|
|
||||||
if (miningManager.canUseDemolitionsExpertise()) {
|
if (miningManager.canUseDemolitionsExpertise()) {
|
||||||
@ -231,6 +244,10 @@ public class EntityListener implements Listener {
|
|||||||
Tameable pet = (Tameable) livingEntity;
|
Tameable pet = (Tameable) livingEntity;
|
||||||
AnimalTamer owner = pet.getOwner();
|
AnimalTamer owner = pet.getOwner();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, livingEntity.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Taming.canPreventDamage(pet, owner)) {
|
if (Taming.canPreventDamage(pet, owner)) {
|
||||||
Player player = (Player) owner;
|
Player player = (Player) owner;
|
||||||
Wolf wolf = (Wolf) pet;
|
Wolf wolf = (Wolf) pet;
|
||||||
@ -356,6 +373,10 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, entity.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||||
|
|
||||||
if (miningManager.canUseBiggerBombs()) {
|
if (miningManager.canUseBiggerBombs()) {
|
||||||
@ -370,7 +391,7 @@ public class EntityListener implements Listener {
|
|||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
if (entity instanceof TNTPrimed && entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
if (entity instanceof TNTPrimed && entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
||||||
@ -381,6 +402,10 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, entity.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||||
|
|
||||||
if (miningManager.canUseBlastMining()) {
|
if (miningManager.canUseBlastMining()) {
|
||||||
@ -427,6 +452,10 @@ public class EntityListener implements Listener {
|
|||||||
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||||
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||||
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Permissions.farmersDiet(player)) {
|
if (Permissions.farmersDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||||
}
|
}
|
||||||
@ -436,18 +465,30 @@ public class EntityListener implements Listener {
|
|||||||
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Permissions.farmersDiet(player)) {
|
if (Permissions.farmersDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.FISHING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Permissions.fishermansDiet(player)) {
|
if (Permissions.fishermansDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.FISHING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Permissions.fishermansDiet(player)) {
|
if (Permissions.fishermansDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
@ -469,6 +510,10 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getOwner();
|
Player player = (Player) event.getOwner();
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
if (Misc.isNPCEntity(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -490,6 +535,10 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) target;
|
Player player = (Player) target;
|
||||||
Tameable tameable = (Tameable) entity;
|
Tameable tameable = (Tameable) entity;
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CombatUtils.isFriendlyPet(player, tameable)) {
|
if (!CombatUtils.isFriendlyPet(player, tameable)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import org.bukkit.metadata.MetadataValue;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.WorldConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@ -45,6 +46,10 @@ public class InventoryListener implements Listener {
|
|||||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
HumanEntity player = event.getPlayer();
|
HumanEntity player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -75,6 +80,10 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Inventory inventory = event.getInventory();
|
Inventory inventory = event.getInventory();
|
||||||
|
|
||||||
if (inventory instanceof FurnaceInventory) {
|
if (inventory instanceof FurnaceInventory) {
|
||||||
@ -99,6 +108,10 @@ public class InventoryListener implements Listener {
|
|||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
BlockState furnaceState = furnaceBlock.getState();
|
BlockState furnaceState = furnaceBlock.getState();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, furnaceState.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (furnaceState instanceof Furnace) {
|
if (furnaceState instanceof Furnace) {
|
||||||
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
|
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
|
||||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||||
@ -121,6 +134,10 @@ public class InventoryListener implements Listener {
|
|||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
BlockState furnaceState = furnaceBlock.getState();
|
BlockState furnaceState = furnaceBlock.getState();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, furnaceState.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (furnaceState instanceof Furnace) {
|
if (furnaceState instanceof Furnace) {
|
||||||
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
|
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
|
||||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||||
@ -151,6 +168,10 @@ public class InventoryListener implements Listener {
|
|||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
BlockState furnaceState = furnaceBlock.getState();
|
BlockState furnaceState = furnaceBlock.getState();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, furnaceState.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (furnaceState instanceof Furnace) {
|
if (furnaceState instanceof Furnace) {
|
||||||
ItemStack result = ((Furnace) furnaceState).getInventory().getResult();
|
ItemStack result = ((Furnace) furnaceState).getInventory().getResult();
|
||||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||||
|
@ -31,12 +31,14 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.chat.ChatManager;
|
import com.gmail.nossr50.chat.ChatManager;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.WorldConfig;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.ShareHandler;
|
import com.gmail.nossr50.party.ShareHandler;
|
||||||
|
import com.gmail.nossr50.runnables.skills.AbilityDisableTask;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||||
@ -125,6 +127,16 @@ public class PlayerListener implements Listener {
|
|||||||
mcMMOPlayer.removeParty();
|
mcMMOPlayer.removeParty();
|
||||||
player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
|
player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (AbilityType abilityType : AbilityType.values()) {
|
||||||
|
if (mcMMOPlayer.getAbilityMode(abilityType)) {
|
||||||
|
if (!WorldConfig.getInstance().isAbilityEnabled(SkillType.byAbility(abilityType), player.getWorld().getName())) {
|
||||||
|
// Make sure to handle any important deactivation processes
|
||||||
|
new AbilityDisableTask(mcMMOPlayer, abilityType).run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,6 +182,10 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerFish(PlayerFishEvent event) {
|
public void onPlayerFish(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.FISHING, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player) || !Permissions.skillEnabled(player, SkillType.FISHING)) {
|
if (Misc.isNPCEntity(player) || !Permissions.skillEnabled(player, SkillType.FISHING)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -345,6 +361,10 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.REPAIR, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -356,6 +376,10 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* SALVAGE CHECKS */
|
||||||
else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(heldItem) && !ItemUtils.isChainmailArmor(heldItem)) {
|
else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(heldItem) && !ItemUtils.isChainmailArmor(heldItem)) {
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.REPAIR, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -367,6 +391,10 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
/* BLAST MINING CHECK */
|
/* BLAST MINING CHECK */
|
||||||
else if (miningManager.canDetonate()) {
|
else if (miningManager.canDetonate()) {
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (blockID == Material.TNT.getId()) {
|
if (blockID == Material.TNT.getId()) {
|
||||||
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
||||||
}
|
}
|
||||||
@ -380,6 +408,10 @@ public class PlayerListener implements Listener {
|
|||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
blockID = block.getTypeId();
|
blockID = block.getTypeId();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.REPAIR, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
@ -404,6 +436,10 @@ public class PlayerListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RIGHT_CLICK_AIR:
|
case RIGHT_CLICK_AIR:
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* BLAST MINING CHECK */
|
/* BLAST MINING CHECK */
|
||||||
if (miningManager.canDetonate()) {
|
if (miningManager.canDetonate()) {
|
||||||
miningManager.remoteDetonation();
|
miningManager.remoteDetonation();
|
||||||
@ -460,6 +496,10 @@ public class PlayerListener implements Listener {
|
|||||||
ChimaeraWing.activationCheck(player);
|
ChimaeraWing.activationCheck(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* GREEN THUMB CHECK */
|
/* GREEN THUMB CHECK */
|
||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
@ -500,6 +540,10 @@ public class PlayerListener implements Listener {
|
|||||||
case LEFT_CLICK_AIR:
|
case LEFT_CLICK_AIR:
|
||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* CALL OF THE WILD CHECKS */
|
/* CALL OF THE WILD CHECKS */
|
||||||
if (player.isSneaking() && Permissions.callOfTheWild(player)) {
|
if (player.isSneaking() && Permissions.callOfTheWild(player)) {
|
||||||
Material type = heldItem.getType();
|
Material type = heldItem.getType();
|
||||||
|
@ -16,6 +16,7 @@ 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.WorldConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
||||||
@ -276,6 +277,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
TreasureConfig.getInstance();
|
TreasureConfig.getInstance();
|
||||||
HiddenConfig.getInstance();
|
HiddenConfig.getInstance();
|
||||||
AdvancedConfig.getInstance();
|
AdvancedConfig.getInstance();
|
||||||
|
WorldConfig.getInstance();
|
||||||
new ChildConfig();
|
new ChildConfig();
|
||||||
|
|
||||||
List<Repairable> repairables = new ArrayList<Repairable>();
|
List<Repairable> repairables = new ArrayList<Repairable>();
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
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.WorldConfig;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
|
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
|
||||||
@ -44,6 +45,10 @@ public final class MobHealthbarUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isMobHealthEnabled(player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||||
|
|
||||||
if (profile.getMobHealthbarType() == null) {
|
if (profile.getMobHealthbarType() == null) {
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.block.BlockState;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.config.WorldConfig;
|
||||||
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 {
|
||||||
@ -303,6 +304,10 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isBlockStoreEnabled(world.getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int cx = x / 16;
|
int cx = x / 16;
|
||||||
int cz = z / 16;
|
int cz = z / 16;
|
||||||
String key = world.getName() + "," + cx + "," + cz;
|
String key = world.getName() + "," + cx + "," + cz;
|
||||||
@ -346,6 +351,10 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isBlockStoreEnabled(world.getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int cx = x / 16;
|
int cx = x / 16;
|
||||||
int cz = z / 16;
|
int cz = z / 16;
|
||||||
|
|
||||||
@ -392,6 +401,10 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isBlockStoreEnabled(world.getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int cx = x / 16;
|
int cx = x / 16;
|
||||||
int cz = z / 16;
|
int cz = z / 16;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.WorldConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
@ -65,6 +66,7 @@ public final class CombatUtils {
|
|||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
if (target instanceof Tameable) {
|
if (target instanceof Tameable) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
|
||||||
if (heldItem.getType() == Material.BONE) {
|
if (heldItem.getType() == Material.BONE) {
|
||||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||||
|
|
||||||
@ -79,8 +81,10 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ItemUtils.isSword(heldItem)) {
|
if (ItemUtils.isSword(heldItem)) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.SWORDS, player.getWorld().getName())) {
|
||||||
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
|
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -103,7 +107,9 @@ public final class CombatUtils {
|
|||||||
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
|
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (ItemUtils.isAxe(heldItem)) {
|
else if (ItemUtils.isAxe(heldItem)) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.AXES, player.getWorld().getName())) {
|
||||||
if (!shouldProcessSkill(target, SkillType.AXES)) {
|
if (!shouldProcessSkill(target, SkillType.AXES)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,7 +143,9 @@ public final class CombatUtils {
|
|||||||
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (heldItem.getType() == Material.AIR) {
|
else if (heldItem.getType() == Material.AIR) {
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.UNARMED, player.getWorld().getName())) {
|
||||||
if (!shouldProcessSkill(target, SkillType.UNARMED)) {
|
if (!shouldProcessSkill(target, SkillType.UNARMED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -165,11 +173,16 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (damager.getType()) {
|
switch (damager.getType()) {
|
||||||
case WOLF:
|
case WOLF:
|
||||||
Wolf wolf = (Wolf) damager;
|
Wolf wolf = (Wolf) damager;
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, wolf.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
||||||
Player master = (Player) wolf.getOwner();
|
Player master = (Player) wolf.getOwner();
|
||||||
|
|
||||||
@ -206,7 +219,11 @@ public final class CombatUtils {
|
|||||||
case ARROW:
|
case ARROW:
|
||||||
LivingEntity shooter = ((Arrow) damager).getShooter();
|
LivingEntity shooter = ((Arrow) damager).getShooter();
|
||||||
|
|
||||||
/* Break instead of return due to Dodge/Counter/Deflect abilities */
|
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.ARCHERY, shooter.getWorld().getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Break instead of return due to Dodge/Counter/Deflect abilities
|
||||||
if (shooter == null || !(shooter instanceof Player)) {
|
if (shooter == null || !(shooter instanceof Player)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -268,12 +285,15 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.ACROBATICS, player.getWorld().getName())) {
|
||||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||||
|
|
||||||
if (acrobaticsManager.canDodge(damager)) {
|
if (acrobaticsManager.canDodge(damager)) {
|
||||||
event.setDamage(acrobaticsManager.dodgeCheck(event.getDamage()));
|
event.setDamage(acrobaticsManager.dodgeCheck(event.getDamage()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.SWORDS, player.getWorld().getName())) {
|
||||||
if (ItemUtils.isSword(player.getItemInHand())) {
|
if (ItemUtils.isSword(player.getItemInHand())) {
|
||||||
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
|
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
|
||||||
return;
|
return;
|
||||||
@ -285,7 +305,9 @@ public final class CombatUtils {
|
|||||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WorldConfig.getInstance().isSkillEnabled(SkillType.UNARMED, player.getWorld().getName())) {
|
||||||
if (damager.getType() == EntityType.ARROW) {
|
if (damager.getType() == EntityType.ARROW) {
|
||||||
LivingEntity shooter = ((Arrow) damager).getShooter();
|
LivingEntity shooter = ((Arrow) damager).getShooter();
|
||||||
|
|
||||||
@ -304,6 +326,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (attacker instanceof Player) {
|
else if (attacker instanceof Player) {
|
||||||
Player player = (Player) attacker;
|
Player player = (Player) attacker;
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
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.WorldConfig;
|
||||||
|
import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
@ -294,6 +296,10 @@ public class SkillUtils {
|
|||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
|
if (!WorldConfig.getInstance().isAbilityEnabled(type, player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Axes and Woodcutting are odd because they share the same tool.
|
* Axes and Woodcutting are odd because they share the same tool.
|
||||||
* We show them the too tired message when they take action.
|
* We show them the too tired message when they take action.
|
||||||
|
39
src/main/resources/worlds.yml
Normal file
39
src/main/resources/worlds.yml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
Worlds:
|
||||||
|
## Copy the default section and replace 'default' with the name of a world to enable world specific settings for that world
|
||||||
|
default:
|
||||||
|
Skills:
|
||||||
|
Acrobatics:
|
||||||
|
Enabled: true
|
||||||
|
Archery:
|
||||||
|
Enabled: true
|
||||||
|
Axes:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
Excavation:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
Fishing:
|
||||||
|
Enabled: true
|
||||||
|
Herbalism:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
Mining:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
Repair:
|
||||||
|
Enabled: true
|
||||||
|
Smelting:
|
||||||
|
Enabled: true
|
||||||
|
Swords:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
Taming:
|
||||||
|
Enabled: true
|
||||||
|
Unarmed:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
Woodcutting:
|
||||||
|
Enabled: true
|
||||||
|
AbilityEnabled: true
|
||||||
|
BlockStore: true
|
||||||
|
MobHealthBar: true
|
Loading…
Reference in New Issue
Block a user