mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 18:24:43 +02:00
Added option to allow refreshing of chunks after block-breaking abilities.
This, if enabled, should fix the problem of clients believing they have broken more blocks than they really have when the enchanced enchantment is removed. If testing proves it to be useful, could be enabled by default. This currently send a 3x3 set of chunks centered around the player, so some servers may wish to disable it in that case.
This commit is contained in:
@ -11,6 +11,7 @@ public class HiddenConfig {
|
||||
private static boolean chunkletsEnabled;
|
||||
private static int conversionRate;
|
||||
private static boolean useEnchantmentBuffs;
|
||||
private static boolean resendChunksAfterBlockAbility;
|
||||
|
||||
public HiddenConfig(String fileName) {
|
||||
HiddenConfig.fileName = fileName;
|
||||
@ -31,6 +32,7 @@ public class HiddenConfig {
|
||||
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
||||
conversionRate = config.getInt("Options.ConversionRate", 1);
|
||||
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
||||
resendChunksAfterBlockAbility = config.getBoolean("Options.RefreshChunks", false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,4 +47,8 @@ public class HiddenConfig {
|
||||
public boolean useEnchantmentBuffs() {
|
||||
return useEnchantmentBuffs;
|
||||
}
|
||||
|
||||
public boolean resendChunksAfterBlockAbility() {
|
||||
return resendChunksAfterBlockAbility;
|
||||
}
|
||||
}
|
||||
|
@ -189,6 +189,14 @@ public final class Misc {
|
||||
}
|
||||
}
|
||||
|
||||
public static void resendChunkRadiusAt(Player player, int radius) {
|
||||
for (int x = player.getLocation().getChunk().getX() - radius; x < player.getLocation().getChunk().getX() + radius; x++) {
|
||||
for (int z = player.getLocation().getChunk().getZ() - radius; z < player.getLocation().getChunk().getZ() + radius; z++) {
|
||||
player.getWorld().refreshChunk(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
|
@ -187,6 +187,10 @@ public class SkillUtils {
|
||||
handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
|
||||
if (HiddenConfig.getInstance().resendChunksAfterBlockAbility() && (ability == AbilityType.BERSERK || ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
Misc.resendChunkRadiusAt(player, 1);
|
||||
}
|
||||
|
||||
mcMMOPlayer.setAbilityMode(ability, false);
|
||||
mcMMOPlayer.setAbilityInformed(ability, false);
|
||||
|
||||
|
Reference in New Issue
Block a user