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

Compare commits

...

22 Commits

Author SHA1 Message Date
T00thpick1
66de4f7cab Move default to own key section 2013-05-19 18:20:04 -04:00
T00thpick1
fc935ce9dd Worlds config beta 2013-05-19 18:20:02 -04:00
t00thpick1
2ee919b51f Update gravatar 2013-05-19 18:18:55 -03:00
T00thpick1
22f6ae858b Update inventories after chimera wing 2013-05-19 16:13:19 -04:00
T00thpick1
3c3b4af2c4 No salvaging chainmail - FIXES 1118 2013-05-19 12:55:18 -04:00
T00thpick1
feb0d1fe5d Things that should never happen, but are. 2013-05-18 22:15:32 -04:00
TfT_02
2d66b8ed12 Cleanup - fixing various formatting issues 2013-05-18 22:41:42 +02:00
TfT_02
483f348403 Fixed bug with Blast Mining where the Ability refreshed message was being send too early 2013-05-18 22:27:17 +02:00
TfT_02
a8a5100f58 Update the changelog
Also made a minor edit to a comment about the powerlevel display
2013-05-18 14:27:14 +02:00
TfT_02
1f9dc70bb1 I forgot to remove the setting from advanced.yml 2013-05-18 14:12:45 +02:00
TfT_02
7f1ef61657 Get rid of the SuccessModifier
There's no need for this modifier, because the user can define the
exact chance for Rolls and Gracefull Rolls in the config file. This
means that the ratio between the two is already configurable.
2013-05-18 14:12:07 +02:00
TfT_02
2e74c079b0 Set the enchant buff level to 1 if it's lower than 0
Prevents issue #1006 from happening again.

If a user wants to disable SuperBreaker, they should do this using
permissions and not by setting the Enchant Buff level to zero.
2013-05-18 11:37:40 +02:00
TfT_02
ce4295289a Changed powerlevel display setting to disabled by default.
Because scoreboards are being cached by Minecraft in scoreboard.dat it
is no user friendly to enabled this by default. Users will have to
manually delete this file in order to actually disable this.
Described in #1105
2013-05-18 11:27:17 +02:00
T00thpick1
7fde04851d Typo 2013-05-17 18:44:23 -04:00
riking
71d030e5ad Change rounding strategy to ceiling for mob healthbars 2013-05-17 00:19:59 -04:00
T00thpick1
b08649d0a4 Not much help if not static 2013-05-16 23:58:49 -04:00
T00thpick1
0a11a9a2c8 More methods for SkillType 2013-05-16 22:00:40 -04:00
T00thpick1
068f47b523 Option for any distance 2013-05-16 19:53:58 -04:00
T00thpick1
79aab57abc Configure the inspect distance 2013-05-16 19:31:12 -04:00
T00thpick1
2cf58f1b5b Why break when we can return? 2013-05-16 18:04:14 -04:00
T00thpick1
9678875b4b We do enjoy killing off orphans 2013-05-16 17:26:16 -04:00
GJ
d1a7ce827a Back to active development. Again. 2013-05-16 16:24:19 -04:00
39 changed files with 525 additions and 165 deletions

View File

@@ -46,6 +46,8 @@ Version 1.4.06-dev
= Fixed bug with removing players from mySQL database
= Fixed bug with empty metadata lists and Smelting
= Fixed bug where Blast Mining would drop wrong items
= Fixed bug with Blast Mining where the Ability refreshed message was being send too early
= Fixed bug where the chance of a successful Gracefull Roll was twice as high as displayed
! Changed Spout notification tiers to be stored in SpoutConfig instead of AdvancedConfig
! Changed Berserk to add items to inventory rather than denying pickup
! Changed Call of the Wild, newly summoned pet's will have a custom name. (added permission node to disable this)

View File

@@ -29,7 +29,7 @@ mcMMO is currently developed by a team of individuals from all over the world.
(https://github.com/shatteredbeam)
[![TfT_02](http://www.gravatar.com/avatar/b8914f9970e1f6ffd5281ce4770e20a7.png)]
(https://github.com/TfT-02)
[![t00thpick1](http://www.gravatar.com/avatar/??.png)]
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)]
(https://github.com/t00thpick1)
## Compiling

View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.4.06-beta4</version>
<version>1.4.06-dev5</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement>

View File

@@ -138,7 +138,7 @@ public final class ChatAPI {
*
* @param playerName The name of the player to toggle party chat on.
*/
public static void toggleAdminChat(String playerName){
public static void toggleAdminChat(String playerName) {
UserManager.getPlayer(playerName).setAdminChat(!isUsingAdminChat(playerName));
}
}

View File

@@ -119,7 +119,7 @@ public final class ExperienceAPI {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**

View File

@@ -12,7 +12,7 @@ import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
public final class ChatManager {
public ChatManager () {}
public ChatManager() {}
public static void handleAdminChat(Plugin plugin, String playerName, String displayName, String message, boolean isAsync) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(plugin, playerName, displayName, message, isAsync);

View File

@@ -20,7 +20,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
/* GENERAL */
public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); }
public int getEnchantBuff() { return config.getInt("Skills.General.Ability_EnchantBuff", 5); }
public int getEnchantBuff() {
int buff = config.getInt("Skills.General.Ability_EnchantBuff", 5);
return (buff <= 0) ? 1 : buff;
}
/* ACROBATICS */
public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge_ChanceMax", 20.0D); }
@@ -34,7 +37,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public double getGracefulRollChanceMax() { return config.getDouble("Skills.Acrobatics.GracefulRoll_ChanceMax", 100.0D); }
public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); }
public int getGracefulRollDamageThreshold() { return config.getInt("Skills.Acrobatics.GracefulRoll_DamageThreshold", 14); }
public int getGracefulRollSuccessModifer() { return config.getInt("Skills.Acrobatics.GracefulRoll_SuccessModifier", 2); }
public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); }
public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); }

View File

@@ -80,7 +80,7 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getSkillScoreboardEnabled() { return config.getBoolean("Scoreboards.Skillname.Use", true); }
public int getSkillScoreboardTime() { return config.getInt("Scoreboards.Skillname.Display_Time", 10); }
public boolean getPowerLevelsEnabled() { return config.getBoolean("Scoreboards.Power_Level.Use", true); }
public boolean getPowerLevelsEnabled() { return config.getBoolean("Scoreboards.Power_Level.Use", false); }
/* Database Purging */
public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
@@ -172,6 +172,9 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Confirm_Required", true); }
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
/* Inspect command distance */
public double getInspectDistance() { return config.getDouble("Commands.inspect.Max_Distance", 30); }
/*
* ABILITY SETTINGS
*/

View File

@@ -57,7 +57,7 @@ public abstract class ConfigLoader {
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(configFile);
outputStream = new FileOutputStream(configFile);
int read;
byte[] bytes = new byte[1024];

View 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." + world + ".Skills." + skill + ".Enabled", isSkillEnabled(skill));
}
public boolean isAbilityEnabled(SkillType skillType, String world) {
String skill = StringUtils.getCapitalized(skillType.toString());
return config.getBoolean("Worlds." + world + ".Skills." + skill + ".AbilityEnabled", isAbilityEnabled(skill));
}
public boolean isBlockStoreEnabled(String world) { return config.getBoolean("Worlds." + world + ".BlockStore", isBlockStoreEnabled()); }
public boolean isMobHealthEnabled(String world) { return config.getBoolean("Worlds." + world + ".MobHealthBar", isMobHealthEnabled()); }
// Default settings
private boolean isSkillEnabled(String skill) { return config.getBoolean("Default.Skills." + skill + ".Enabled", true); }
private boolean isAbilityEnabled(String skill) { return config.getBoolean("Default.Skills." + skill + ".AbilityEnabled", true); }
private boolean isBlockStoreEnabled() { return config.getBoolean("Default.BlockStore", true); }
private boolean isMobHealthEnabled() { return config.getBoolean("Default.MobHealthBar", true); }
}

View File

@@ -151,6 +151,7 @@ public final class SQLDatabaseManager {
checkDatabaseStructure(DatabaseUpdateType.INDEX);
checkDatabaseStructure(DatabaseUpdateType.MOB_HEALTHBARS);
checkDatabaseStructure(DatabaseUpdateType.PARTY_NAMES);
checkDatabaseStructure(DatabaseUpdateType.KILL_ORPHANS);
}
/**
@@ -563,7 +564,7 @@ public final class SQLDatabaseManager {
+ "ADD INDEX `idx_acrobatics` (`acrobatics`) USING BTREE, "
+ "ADD INDEX `idx_fishing` (`fishing`) USING BTREE;");
}
break;
return;
case MOB_HEALTHBARS:
sql = "SELECT * FROM `" + tablePrefix + "huds` ORDER BY `" + tablePrefix + "huds`.`mobhealthbar` ASC LIMIT 0 , 30";
@@ -571,7 +572,35 @@ public final class SQLDatabaseManager {
case PARTY_NAMES:
write("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party` ;");
break;
return;
case KILL_ORPHANS:
mcMMO.p.getLogger().info("Killing orphans");
write(
"DELETE FROM " + tablePrefix + "experience " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "experience.user_id = u.id);"
);
write(
"DELETE FROM " + tablePrefix + "huds " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "huds.user_id = u.id);"
);
write(
"DELETE FROM " + tablePrefix + "cooldowns " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "cooldowns.user_id = u.id);"
);
write(
"DELETE FROM " + tablePrefix + "skills " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "skills.user_id = u.id);"
);
return;
default:
break;

View File

@@ -5,5 +5,7 @@ public enum DatabaseUpdateType {
BLAST_MINING,
INDEX,
MOB_HEALTHBARS,
PARTY_NAMES,
PARTY_NAMES,
KILL_ORPHANS,
;
}

View File

@@ -513,7 +513,7 @@ public class McMMOPlayer {
return;
}
if (!Permissions.skillEnabled(player, skillType)) {
return;
}

View File

@@ -257,7 +257,7 @@ public class PlayerProfile {
* @return the Xp remaining until next level
*/
public int getXpToLevel(SkillType skillType) {
return 1020 + (skills.get(skillType) * Config.getInstance().getFormulaMultiplierCurve());
return 1020 + (skills.get(skillType) * Config.getInstance().getFormulaMultiplierCurve());
}
private int getChildSkillLevel(SkillType skillType) {
@@ -325,12 +325,17 @@ public class PlayerProfile {
"c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, " +
"h.hudtype, h.mobhealthbar " +
"FROM " + tablePrefix + "users u " +
"JOIN " + tablePrefix + "skills s ON (u.id = e.user_id) " +
"JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " +
"JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) " +
"JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " +
"JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " +
"WHERE u.user = '" + playerName + "'"
).get(1);
// Should never happen but just in case
if (playerData == null || playerData.size() == 0) {
return false;
}
}
userId = Integer.valueOf(playerData.get(0));
@@ -374,8 +379,20 @@ public class PlayerProfile {
// Acrobatics 35 - Unused
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(playerData.get(36)));
hudType = HudType.valueOf(playerData.get(37));
mobHealthbarType = MobHealthbarType.valueOf(playerData.get(38));
try {
hudType = HudType.valueOf(playerData.get(37));
}
catch (Exception e) {
// Shouldn't happen unless database is being tampered with
hudType = HudType.STANDARD;
}
try {
mobHealthbarType = MobHealthbarType.valueOf(playerData.get(38));
}
catch (Exception e) {
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
}
loaded = true;
return true;

View File

@@ -141,6 +141,25 @@ public enum SkillType {
}
}
public static SkillType[] nonChildSkills() {
return new SkillType[] {SkillType.ACROBATICS,
SkillType.ARCHERY,
SkillType.AXES,
SkillType.EXCAVATION,
SkillType.FISHING,
SkillType.HERBALISM,
SkillType.MINING,
SkillType.REPAIR,
SkillType.SWORDS,
SkillType.TAMING,
SkillType.UNARMED,
SkillType.WOODCUTTING };
}
public static SkillType[] childSkills() {
return new SkillType[] { SkillType.SMELTING };
}
public Color getRunescapeModeColor() {
return runescapeColor;
}
@@ -151,7 +170,7 @@ public enum SkillType {
return type;
}
}
return null;
}
}

View File

@@ -14,7 +14,7 @@ public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerSkillEvent {
super(player, skill);
this.ability = skill.getAbility();
}
public AbilityType getAbility() {
return ability;
}

View File

@@ -22,6 +22,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.WorldConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -58,6 +59,10 @@ public class BlockListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if (!WorldConfig.getInstance().isBlockStoreEnabled(event.getBlock().getWorld().getName()) || !HiddenConfig.getInstance().getChunkletsEnabled()) {
return;
}
List<Block> blocks = event.getBlocks();
BlockFace direction = event.getDirection();
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) {
if (event.isSticky()) {
// 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);
}
}
@@ -146,47 +155,61 @@ public class BlockListener implements Listener {
/* HERBALISM */
if (BlockUtils.affectedByGreenTerra(blockState)) {
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
if (WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, blockState.getWorld().getName())) {
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
/* Green Terra */
if (herbalismManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.HERBALISM);
}
/* Green Terra */
if (herbalismManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.HERBALISM);
}
/*
* We don't check the block store here because herbalism has too many unusual edge cases.
* Instead, we check it inside the drops handler.
*/
if (Permissions.skillEnabled(player, SkillType.HERBALISM)) {
herbalismManager.herbalismBlockCheck(blockState);
/*
* We don't check the block store here because Herbalism has too many unusual edge cases.
* Instead, we check it inside the drops handler.
*/
if (Permissions.skillEnabled(player, SkillType.HERBALISM)) {
herbalismManager.herbalismBlockCheck(blockState);
}
}
}
/* MINING */
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.getPlaceStore().isTrue(blockState)) {
MiningManager miningManager = mcMMOPlayer.getMiningManager();
miningManager.miningBlockCheck(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.miningBlockCheck(blockState);
}
}
}
/* WOOD CUTTING */
else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.getPlaceStore().isTrue(blockState)) {
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
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();
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
woodcuttingManager.processTreeFeller(blockState);
}
else {
woodcuttingManager.woodcuttingBlockCheck(blockState);
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
woodcuttingManager.processTreeFeller(blockState);
}
else {
woodcuttingManager.woodcuttingBlockCheck(blockState);
}
}
}
}
/* EXCAVATION */
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.getPlaceStore().isTrue(blockState)) {
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
excavationManager.excavationBlockCheck(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.excavationBlockCheck(blockState);
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
excavationManager.gigaDrillBreaker(blockState);
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
excavationManager.gigaDrillBreaker(blockState);
}
}
}
}
@@ -215,6 +238,10 @@ public class BlockListener implements Listener {
ItemStack heldItem = player.getItemInHand();
if (ItemUtils.isSword(heldItem)) {
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, blockState.getWorld().getName())) {
return;
}
HerbalismManager herbalismManager = UserManager.getPlayer(player).getHerbalismManager();
if (herbalismManager.canUseHylianLuck()) {
@@ -225,6 +252,10 @@ public class BlockListener implements Listener {
}
}
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();
if (smeltingManager.canUseFluxMining(blockState)) {

View File

@@ -33,7 +33,9 @@ import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.WorldConfig;
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.FakeEntityDamageEvent;
import com.gmail.nossr50.party.PartyManager;
@@ -59,6 +61,9 @@ public class EntityListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityShootBow(EntityShootBowEvent event) {
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.ARCHERY, event.getEntity().getWorld().getName())) {
return;
}
ItemStack bow = event.getBow();
if (bow != null) {
@@ -194,6 +199,10 @@ public class EntityListener implements Listener {
switch (cause) {
case FALL:
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.ACROBATICS, player.getWorld().getName())) {
break;
}
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
if (acrobaticsManager.canRoll()) {
@@ -207,6 +216,10 @@ public class EntityListener implements Listener {
break;
case BLOCK_EXPLOSION:
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, player.getWorld().getName())) {
break;
}
MiningManager miningManager = mcMMOPlayer.getMiningManager();
if (miningManager.canUseDemolitionsExpertise()) {
@@ -231,6 +244,10 @@ public class EntityListener implements Listener {
Tameable pet = (Tameable) livingEntity;
AnimalTamer owner = pet.getOwner();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, livingEntity.getWorld().getName())) {
return;
}
if (Taming.canPreventDamage(pet, owner)) {
Player player = (Player) owner;
Wolf wolf = (Wolf) pet;
@@ -356,6 +373,10 @@ public class EntityListener implements Listener {
return;
}
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, entity.getWorld().getName())) {
return;
}
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
if (miningManager.canUseBiggerBombs()) {
@@ -370,7 +391,7 @@ public class EntityListener implements Listener {
* @param event The event to modify
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEnitityExplode(EntityExplodeEvent event) {
public void onEntityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (entity instanceof TNTPrimed && entity.hasMetadata(mcMMO.tntMetadataKey)) {
@@ -381,6 +402,10 @@ public class EntityListener implements Listener {
return;
}
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, entity.getWorld().getName())) {
return;
}
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
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 MUSHROOM_SOUP: /* 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)) {
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 POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/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)) {
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
}
return;
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)) {
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
}
return;
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)) {
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
}
@@ -469,6 +510,10 @@ public class EntityListener implements Listener {
Player player = (Player) event.getOwner();
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)) {
return;
}
@@ -490,6 +535,10 @@ public class EntityListener implements Listener {
Player player = (Player) target;
Tameable tameable = (Tameable) entity;
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
return;
}
if (!CombatUtils.isFriendlyPet(player, tameable)) {
return;
}

View File

@@ -26,6 +26,7 @@ import org.bukkit.metadata.MetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.util.ItemUtils;
@@ -45,6 +46,10 @@ public class InventoryListener implements Listener {
public void onInventoryOpen(InventoryOpenEvent event) {
HumanEntity player = event.getPlayer();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, player.getWorld().getName())) {
return;
}
if (Misc.isNPCEntity(player)) {
return;
}
@@ -75,6 +80,10 @@ public class InventoryListener implements Listener {
return;
}
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, player.getWorld().getName())) {
return;
}
Inventory inventory = event.getInventory();
if (inventory instanceof FurnaceInventory) {
@@ -99,6 +108,10 @@ public class InventoryListener implements Listener {
Block furnaceBlock = event.getBlock();
BlockState furnaceState = furnaceBlock.getState();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, furnaceState.getWorld().getName())) {
return;
}
if (furnaceState instanceof Furnace) {
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
@@ -121,6 +134,10 @@ public class InventoryListener implements Listener {
Block furnaceBlock = event.getBlock();
BlockState furnaceState = furnaceBlock.getState();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, furnaceState.getWorld().getName())) {
return;
}
if (furnaceState instanceof Furnace) {
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
@@ -151,6 +168,10 @@ public class InventoryListener implements Listener {
Block furnaceBlock = event.getBlock();
BlockState furnaceState = furnaceBlock.getState();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.SMELTING, furnaceState.getWorld().getName())) {
return;
}
if (furnaceState instanceof Furnace) {
ItemStack result = ((Furnace) furnaceState).getInventory().getResult();
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);

View File

@@ -31,12 +31,14 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldConfig;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.runnables.skills.AbilityDisableTask;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
@@ -125,6 +127,16 @@ public class PlayerListener implements Listener {
mcMMOPlayer.removeParty();
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) {
Player player = event.getPlayer();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.FISHING, player.getWorld().getName())) {
return;
}
if (Misc.isNPCEntity(player) || !Permissions.skillEnabled(player, SkillType.FISHING)) {
return;
}
@@ -345,6 +361,10 @@ public class PlayerListener implements Listener {
/* REPAIR CHECKS */
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();
event.setCancelled(true);
@@ -355,7 +375,11 @@ public class PlayerListener implements Listener {
}
}
/* SALVAGE CHECKS */
else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(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();
event.setCancelled(true);
@@ -367,6 +391,10 @@ public class PlayerListener implements Listener {
}
/* BLAST MINING CHECK */
else if (miningManager.canDetonate()) {
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, player.getWorld().getName())) {
break;
}
if (blockID == Material.TNT.getId()) {
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:
blockID = block.getTypeId();
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.REPAIR, player.getWorld().getName())) {
break;
}
/* REPAIR CHECKS */
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager();
@@ -404,6 +436,10 @@ public class PlayerListener implements Listener {
break;
case RIGHT_CLICK_AIR:
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.MINING, player.getWorld().getName())) {
break;
}
/* BLAST MINING CHECK */
if (miningManager.canDetonate()) {
miningManager.remoteDetonation();
@@ -460,6 +496,10 @@ public class PlayerListener implements Listener {
ChimaeraWing.activationCheck(player);
}
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.HERBALISM, player.getWorld().getName())) {
break;
}
/* GREEN THUMB CHECK */
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
@@ -500,6 +540,10 @@ public class PlayerListener implements Listener {
case LEFT_CLICK_AIR:
case LEFT_CLICK_BLOCK:
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
break;
}
/* CALL OF THE WILD CHECKS */
if (player.isSneaking() && Permissions.callOfTheWild(player)) {
Material type = heldItem.getType();

View File

@@ -16,6 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
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.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
@@ -276,6 +277,7 @@ public class mcMMO extends JavaPlugin {
TreasureConfig.getInstance();
HiddenConfig.getInstance();
AdvancedConfig.getInstance();
WorldConfig.getInstance();
new ChildConfig();
List<Repairable> repairables = new ArrayList<Repairable>();

View File

@@ -14,7 +14,6 @@ public final class Acrobatics {
public static int gracefulRollMaxBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel();
public static int gracefulRollThreshold = AdvancedConfig.getInstance().getGracefulRollDamageThreshold();
public static int gracefulRollSuccessModifier = AdvancedConfig.getInstance().getGracefulRollSuccessModifer();
public static double gracefulRollMaxChance = AdvancedConfig.getInstance().getGracefulRollChanceMax();
public static int dodgeXpModifier = AdvancedConfig.getInstance().getDodgeXPModifier();

View File

@@ -81,7 +81,7 @@ public class AcrobaticsManager extends SkillManager {
int modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel, 1)) {
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
applyXpGain(damage * Acrobatics.rollXpModifier);
@@ -103,7 +103,7 @@ public class AcrobaticsManager extends SkillManager {
private int gracefulRollCheck(int damage) {
int modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel, Acrobatics.gracefulRollSuccessModifier)) {
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel)) {
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
applyXpGain(damage * Acrobatics.rollXpModifier);
@@ -116,8 +116,8 @@ public class AcrobaticsManager extends SkillManager {
return damage;
}
private boolean isSuccessfulRoll(double maxChance, int maxLevel, int successModifier) {
return ((maxChance / maxLevel) * Math.min(getSkillLevel(), maxLevel) * successModifier) > Misc.getRandom().nextInt(activationChance);
private boolean isSuccessfulRoll(double maxChance, int maxLevel) {
return (maxChance / maxLevel) * Math.min(getSkillLevel(), maxLevel) > Misc.getRandom().nextInt(activationChance);
}
private boolean isFatal(int damage) {

View File

@@ -219,7 +219,7 @@ public class FishingManager extends SkillManager {
// Make a hole
block.setType(Material.STATIONARY_WATER);
for (int x = -1; x <= 1; x++) {
for (int x = -1; x <= 1; x++) {
for (int z = -1; z <= 1; z++) {
Block relative = block.getRelative(x, 0, z);

View File

@@ -27,7 +27,7 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
public class MiningManager extends SkillManager{
public class MiningManager extends SkillManager {
public MiningManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.MINING);
}
@@ -109,7 +109,7 @@ public class MiningManager extends SkillManager{
getProfile().setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
mcMMOPlayer.setAbilityInformed(AbilityType.BLAST_MINING, false);
new AbilityCooldownTask(mcMMOPlayer, AbilityType.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, AbilityType.BLAST_MINING.getCooldown());
new AbilityCooldownTask(mcMMOPlayer, AbilityType.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, AbilityType.BLAST_MINING.getCooldown() * 20);
}
/**

View File

@@ -195,7 +195,7 @@ public class RepairManager extends SkillManager {
Player player = getPlayer();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
long LastUse = mcMMOPlayer.getLastAnvilUse(anvilId);
long LastUse = mcMMOPlayer.getLastAnvilUse(anvilId);
// Don't use SkillUtils.cooldownOver() here since that also accounts for the cooldown perks
if ((((LastUse + 3) * Misc.TIME_CONVERSION_FACTOR) >= System.currentTimeMillis()) || !Config.getInstance().getRepairConfirmRequired()) {

View File

@@ -43,7 +43,7 @@ public class Unarmed {
ItemStack addStack = itemstack.clone();
if (dropAmount + itemAmount <= itemMax) {
if (dropAmount + itemAmount <= itemMax) {
drop.remove();
addStack.setAmount(dropAmount + itemAmount);
inventory.setItem(nextSlot, addStack);

View File

@@ -78,6 +78,7 @@ public final class ChimaeraWing {
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
player.setItemInHand(new ItemStack(getChimaeraWing(amount - Config.getInstance().getChimaeraUseCost())));
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.updateInventory();
player.setVelocity(new Vector(0, 0.5D, 0));
CombatUtils.dealDamage(player, Misc.getRandom().nextInt(player.getHealth() - 10));
mcMMOPlayer.actualizeLastTeleport();
@@ -115,6 +116,7 @@ public final class ChimaeraWing {
}
player.setItemInHand(new ItemStack(getChimaeraWing(player.getItemInHand().getAmount() - Config.getInstance().getChimaeraUseCost())));
player.updateInventory();
UserManager.getPlayer(player).actualizeLastTeleport();
if (Config.getInstance().getStatsTrackingEnabled()) {
MetricsManager.chimeraWingUsed();

View File

@@ -660,6 +660,6 @@ public class ItemUtils {
}
ItemMeta itemMeta = item.getItemMeta();
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
}
}

View File

@@ -95,7 +95,7 @@ public final class Misc {
return false;
}
return first.distanceSquared(second) < (maxDistance * maxDistance);
return first.distanceSquared(second) < (maxDistance * maxDistance) || maxDistance == 0;
}
public static void dropItems(Location location, Collection<ItemStack> drops) {

View File

@@ -10,6 +10,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldConfig;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
@@ -35,15 +36,19 @@ public final class MobHealthbarUtils {
/**
* Handle the creation of mob healthbars.
*
* @param profile The
* @param target
* @param damage
* @param player the attacking player
* @param target the targetted entity
* @param damage damage done by the attack triggering this
*/
public static void handleMobHealthbars(Player player, LivingEntity target, int damage) {
if (!Permissions.mobHealthDisplay(player)) {
return;
}
if (!WorldConfig.getInstance().isMobHealthEnabled(player.getWorld().getName())) {
return;
}
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
if (profile.getMobHealthbarType() == null) {
@@ -132,7 +137,7 @@ public final class MobHealthbarUtils {
return null;
}
int coloredDisplay = (int) (fullDisplay * (healthPercentage / 100.0D));
int coloredDisplay = (int) Math.ceil(fullDisplay * (healthPercentage / 100.0D));
int grayDisplay = fullDisplay - coloredDisplay;
String healthbar = color + "";

View File

@@ -17,6 +17,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.WorldConfig;
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
public class HashChunkManager implements ChunkManager {
@@ -303,6 +304,10 @@ public class HashChunkManager implements ChunkManager {
return false;
}
if (!WorldConfig.getInstance().isBlockStoreEnabled(world.getName())) {
return false;
}
int cx = x / 16;
int cz = z / 16;
String key = world.getName() + "," + cx + "," + cz;
@@ -346,6 +351,10 @@ public class HashChunkManager implements ChunkManager {
return;
}
if (!WorldConfig.getInstance().isBlockStoreEnabled(world.getName())) {
return;
}
int cx = x / 16;
int cz = z / 16;
@@ -392,6 +401,10 @@ public class HashChunkManager implements ChunkManager {
return;
}
if (!WorldConfig.getInstance().isBlockStoreEnabled(world.getName())) {
return;
}
int cx = x / 16;
int cz = z / 16;

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -46,7 +47,7 @@ public final class CommandUtils {
}
public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !hasPermission) {
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), Config.getInstance().getInspectDistance()) && !hasPermission) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true;
}

View File

@@ -20,6 +20,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
@@ -65,103 +66,111 @@ public final class CombatUtils {
ItemStack heldItem = player.getItemInHand();
if (target instanceof Tameable) {
if (heldItem.getType() == Material.BONE) {
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
if (WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, player.getWorld().getName())) {
if (heldItem.getType() == Material.BONE) {
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
if (tamingManager.canUseBeastLore()) {
tamingManager.beastLore(target);
event.setCancelled(true);
if (tamingManager.canUseBeastLore()) {
tamingManager.beastLore(target);
event.setCancelled(true);
return;
}
}
if (isFriendlyPet(player, (Tameable) target)) {
return;
}
}
if (isFriendlyPet(player, (Tameable) target)) {
return;
}
}
if (ItemUtils.isSword(heldItem)) {
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
return;
}
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
if (swordsManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.SWORDS);
if (WorldConfig.getInstance().isSkillEnabled(SkillType.SWORDS, player.getWorld().getName())) {
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
return;
}
if (swordsManager.canUseBleed()) {
swordsManager.bleedCheck(target);
}
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
if (swordsManager.canUseSerratedStrike()) {
swordsManager.serratedStrikes(target, event.getDamage());
}
if (swordsManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.SWORDS);
}
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
if (swordsManager.canUseBleed()) {
swordsManager.bleedCheck(target);
}
if (swordsManager.canUseSerratedStrike()) {
swordsManager.serratedStrikes(target, event.getDamage());
}
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
}
}
}
else if (ItemUtils.isAxe(heldItem)) {
if (!shouldProcessSkill(target, SkillType.AXES)) {
return;
}
if (Permissions.skillEnabled(player, SkillType.AXES)) {
AxesManager axesManager = mcMMOPlayer.getAxesManager();
if (axesManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.AXES);
if (WorldConfig.getInstance().isSkillEnabled(SkillType.AXES, player.getWorld().getName())) {
if (!shouldProcessSkill(target, SkillType.AXES)) {
return;
}
if (axesManager.canUseAxeMastery()) {
event.setDamage(axesManager.axeMasteryCheck(event.getDamage()));
}
if (Permissions.skillEnabled(player, SkillType.AXES)) {
AxesManager axesManager = mcMMOPlayer.getAxesManager();
if (axesManager.canCriticalHit(target)) {
event.setDamage(axesManager.criticalHitCheck(target, event.getDamage()));
}
if (axesManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.AXES);
}
if (axesManager.canImpact(target)) {
axesManager.impactCheck(target);
}
else if (axesManager.canGreaterImpact(target)) {
event.setDamage(axesManager.greaterImpactCheck(target, event.getDamage()));
}
if (axesManager.canUseAxeMastery()) {
event.setDamage(axesManager.axeMasteryCheck(event.getDamage()));
}
if (axesManager.canUseSkullSplitter(target)) {
axesManager.skullSplitterCheck(target, event.getDamage());
}
if (axesManager.canCriticalHit(target)) {
event.setDamage(axesManager.criticalHitCheck(target, event.getDamage()));
}
startGainXp(mcMMOPlayer, target, SkillType.AXES);
if (axesManager.canImpact(target)) {
axesManager.impactCheck(target);
}
else if (axesManager.canGreaterImpact(target)) {
event.setDamage(axesManager.greaterImpactCheck(target, event.getDamage()));
}
if (axesManager.canUseSkullSplitter(target)) {
axesManager.skullSplitterCheck(target, event.getDamage());
}
startGainXp(mcMMOPlayer, target, SkillType.AXES);
}
}
}
else if (heldItem.getType() == Material.AIR) {
if (!shouldProcessSkill(target, SkillType.UNARMED)) {
return;
}
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
if (unarmedManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
if (WorldConfig.getInstance().isSkillEnabled(SkillType.UNARMED, player.getWorld().getName())) {
if (!shouldProcessSkill(target, SkillType.UNARMED)) {
return;
}
if (unarmedManager.canUseIronArm()) {
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
}
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
if (unarmedManager.canUseBerserk()) {
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
}
if (unarmedManager.canActivateAbility()) {
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
}
if (unarmedManager.canDisarm(target)) {
unarmedManager.disarmCheck((Player) target);
}
if (unarmedManager.canUseIronArm()) {
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
}
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
if (unarmedManager.canUseBerserk()) {
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
}
if (unarmedManager.canDisarm(target)) {
unarmedManager.disarmCheck((Player) target);
}
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
}
}
}
}
@@ -169,6 +178,10 @@ public final class CombatUtils {
switch (damager.getType()) {
case WOLF:
Wolf wolf = (Wolf) damager;
if (!WorldConfig.getInstance().isSkillEnabled(SkillType.TAMING, wolf.getWorld().getName())) {
break;
}
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
Player master = (Player) wolf.getOwner();
@@ -206,7 +219,11 @@ public final class CombatUtils {
case ARROW:
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)) {
break;
}
@@ -268,39 +285,45 @@ public final class CombatUtils {
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
if (WorldConfig.getInstance().isSkillEnabled(SkillType.ACROBATICS, player.getWorld().getName())) {
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
if (acrobaticsManager.canDodge(damager)) {
event.setDamage(acrobaticsManager.dodgeCheck(event.getDamage()));
}
if (ItemUtils.isSword(player.getItemInHand())) {
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
return;
}
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
if (swordsManager.canUseCounterAttack(damager)) {
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
if (acrobaticsManager.canDodge(damager)) {
event.setDamage(acrobaticsManager.dodgeCheck(event.getDamage()));
}
}
if (damager.getType() == EntityType.ARROW) {
LivingEntity shooter = ((Arrow) damager).getShooter();
if (shooter instanceof Player || !SkillType.UNARMED.getPVEEnabled()) {
return;
}
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
if (unarmedManager.canDeflect()) {
event.setCancelled(unarmedManager.deflectCheck());
if (event.isCancelled()) {
if (WorldConfig.getInstance().isSkillEnabled(SkillType.SWORDS, player.getWorld().getName())) {
if (ItemUtils.isSword(player.getItemInHand())) {
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
return;
}
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
if (swordsManager.canUseCounterAttack(damager)) {
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
}
}
}
if (WorldConfig.getInstance().isSkillEnabled(SkillType.UNARMED, player.getWorld().getName())) {
if (damager.getType() == EntityType.ARROW) {
LivingEntity shooter = ((Arrow) damager).getShooter();
if (shooter instanceof Player || !SkillType.UNARMED.getPVEEnabled()) {
return;
}
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
if (unarmedManager.canDeflect()) {
event.setCancelled(unarmedManager.deflectCheck());
if (event.isCancelled()) {
return;
}
}
}
}
}

View File

@@ -18,6 +18,8 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
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.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType;
@@ -293,6 +295,10 @@ public class SkillUtils {
Player player = mcMMOPlayer.getPlayer();
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
if (!WorldConfig.getInstance().isAbilityEnabled(type, player.getWorld().getName())) {
return;
}
/*
* Axes and Woodcutting are odd because they share the same tool.

View File

@@ -43,7 +43,6 @@ Skills:
GracefulRoll_ChanceMax: 100.0
GracefulRoll_MaxBonusLevel: 500
GracefulRoll_DamageThreshold: 14
GracefulRoll_SuccessModifier: 2
# Amount of experience for performing a dodge, roll or fall
Dodge_XP_Modifier: 120

View File

@@ -56,9 +56,9 @@ Scoreboards:
Skillname:
Use: true
Display_Time: 10
# Should mcMMO display power levels on scoreboards?
# Should mcMMO display power levels on scoreboards? (below player name-tags)
Power_Level:
Use: true
Use: false
Mob_Healthbar:
# Default display for mob health bars - HEARTS, BAR, or DISABLED
@@ -394,6 +394,8 @@ Experience:
Commands:
mcmmo:
Donate_Message: true
inspect:
Max_Distance: 30
ptp:
Cooldown: 120
Warmup: 5

View File

@@ -659,7 +659,7 @@ Skills.Parents = PARENTS
Skills.Stats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
Skills.TooTired=[[RED]]You are too tired to use that ability again. [[YELLOW]]({0}s)
Skills.Cancelled=[[RED]]{0} cancelled!
Skills.ConfirmOrCancel=[[GREEN]]Right-click again to confirm [[GOLD]]{0} [[GREEN]]. Left-click to cancel.
Skills.ConfirmOrCancel=[[GREEN]]Right-click again to confirm [[GOLD]]{0}[[GREEN]]. Left-click to cancel.
#STATISTICS
Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=-

View File

@@ -0,0 +1,40 @@
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
Worlds:
ExampleWorldName:
MobHealthBar: true