forked from Upstream/mmocore
Merge branch 'master' of http://Indyuce@dev.lumine.io/bitbucket/scm/mmo/mmocore.git
This commit is contained in:
commit
83acc8f568
@ -29,7 +29,7 @@ public class CombatRunnable extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (lastHit + 10000 < System.currentTimeMillis()) {
|
||||
if (lastHit + (config.combatLogTimer * 100) < System.currentTimeMillis()) {
|
||||
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, false));
|
||||
config.getSimpleMessage("leave-combat").send(player.getPlayer());
|
||||
close();
|
||||
|
@ -24,6 +24,7 @@ import net.Indyuce.mmocore.manager.CustomBlockManager.BlockInfo;
|
||||
import net.Indyuce.mmocore.manager.RestrictionManager.BlockPermissions;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.CustomBlock;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
private static final BlockFace[] order = { BlockFace.UP, BlockFace.DOWN, BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH };
|
||||
@ -34,7 +35,7 @@ public class BlockListener implements Listener {
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
return;
|
||||
|
||||
String savedData = event.getBlock().getBlockData().getAsString();
|
||||
String savedData = MMOLib.plugin.getVersion().isStrictlyHigher(1, 12) ? event.getBlock().getBlockData().getAsString() : "";
|
||||
Block block = event.getBlock();
|
||||
/*
|
||||
* if custom mining enabled, check for item breaking restrictions
|
||||
@ -104,8 +105,12 @@ public class BlockListener implements Listener {
|
||||
/*
|
||||
* enable block regen.
|
||||
*/
|
||||
if (info.hasRegen())
|
||||
MMOCore.plugin.mineManager.initialize(info.generateRegenInfo(Bukkit.createBlockData(savedData), block.getLocation()));
|
||||
if (info.hasRegen()) {
|
||||
if(MMOLib.plugin.getVersion().isStrictlyHigher(1, 12))
|
||||
MMOCore.plugin.mineManager.initialize(info.generateRegenInfo(Bukkit.createBlockData(savedData), block.getLocation()));
|
||||
else
|
||||
MMOCore.plugin.mineManager.initialize(info.generateRegenInfo(block.getLocation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,16 +50,16 @@ public class PlayerListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void d(EntityDamageByEntityEvent event) {
|
||||
if (event.getEntity().hasMetadata("NPC"))
|
||||
return;
|
||||
if (event.getEntity() instanceof Player)
|
||||
if (event.getEntity() instanceof Player && !event.getEntity().hasMetadata("NPC"))
|
||||
PlayerData.get((Player) event.getEntity()).updateCombat();
|
||||
|
||||
if (event.getDamager() instanceof Player)
|
||||
if (event.getDamager() instanceof Player && !event.getDamager().hasMetadata("NPC"))
|
||||
PlayerData.get((Player) event.getDamager()).updateCombat();
|
||||
|
||||
if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player)
|
||||
if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player) {
|
||||
if(((Player) ((Projectile) event.getDamager()).getShooter()).hasMetadata("NPC")) return;
|
||||
PlayerData.get((Player) ((Projectile) event.getDamager()).getShooter()).updateCombat();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -30,6 +30,7 @@ public class ConfigManager {
|
||||
public double expPartyBuff, regenPartyBuff;
|
||||
public String partyChatPrefix;
|
||||
public ChatColor manaFull, manaHalf, manaEmpty, staminaFull, staminaHalf, staminaEmpty;
|
||||
public int combatLogTimer;
|
||||
|
||||
public final DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
|
||||
public final DecimalFormat decimal = new DecimalFormat("0.#", formatSymbols), decimals = new DecimalFormat("0.##", formatSymbols);
|
||||
@ -100,6 +101,7 @@ public class ConfigManager {
|
||||
regenPartyBuff = MMOCore.plugin.getConfig().getDouble("party.buff.health-regen");
|
||||
partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix");
|
||||
formatSymbols.setDecimalSeparator(getFirstChar(MMOCore.plugin.getConfig().getString("number-format.decimal-separator"), ','));
|
||||
combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer");
|
||||
|
||||
manaFull = getColorOrDefault("mana-whole", ChatColor.BLUE);
|
||||
manaHalf = getColorOrDefault("mana-half", ChatColor.AQUA);
|
||||
|
@ -82,11 +82,11 @@ public class CustomBlockManager extends MMOManager {
|
||||
if(MMOCore.plugin.isMILoaded() && info.getRegen().getCustomRegenBlockID() != 0) {
|
||||
CustomBlock block = MMOItems.plugin.getCustomBlocks().getBlock(info.getRegen().getCustomRegenBlockID());
|
||||
info.getLocation().getBlock().setType(block.getType());
|
||||
info.getLocation().getBlock().setBlockData(block.getBlockData());
|
||||
if(MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) info.getLocation().getBlock().setBlockData(block.getBlockData());
|
||||
}
|
||||
else info.getLocation().getBlock().setType(info.getRegen().getTemporaryBlock());
|
||||
if(isPlayerSkull(info.getLocation().getBlock().getType())) {
|
||||
if(isPlayerSkull(info.getRegen().getBlock())) info.getLocation().getBlock().setBlockData(info.getBlockData());
|
||||
if(isPlayerSkull(info.getRegen().getBlock()) && MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) info.getLocation().getBlock().setBlockData(info.getBlockData());
|
||||
MMOLib.plugin.getNMS().setSkullValue(info.getLocation().getBlock(), info.getRegen().getRegenHeadValue());
|
||||
}
|
||||
|
||||
@ -96,7 +96,8 @@ public class CustomBlockManager extends MMOManager {
|
||||
}
|
||||
|
||||
private void regen(RegenInfo info) {
|
||||
info.getLocation().getBlock().setBlockData(info.getBlockData());
|
||||
if(MMOLib.plugin.getVersion().isStrictlyHigher(1, 12))
|
||||
info.getLocation().getBlock().setBlockData(info.getBlockData());
|
||||
if(isPlayerSkull(info.getLocation().getBlock().getType()))
|
||||
MMOLib.plugin.getNMS().setSkullValue(info.getLocation().getBlock(), info.getRegen().getHeadValue());
|
||||
active.remove(info);
|
||||
@ -216,6 +217,10 @@ public class CustomBlockManager extends MMOManager {
|
||||
return new RegenInfo(data, loc, this);
|
||||
}
|
||||
|
||||
public RegenInfo generateRegenInfo(Location loc) {
|
||||
return new RegenInfo(null, loc, this);
|
||||
}
|
||||
|
||||
public int getCustomBlockID() {
|
||||
return customBlockId;
|
||||
}
|
||||
|
@ -91,6 +91,10 @@ use-chat-input: true
|
||||
# Prevents mobs spawned from spawners from giving XP points.
|
||||
prevent-spawner-xp: true
|
||||
|
||||
#Timer for combat log to expire (in seconds)
|
||||
combat-log:
|
||||
timer: 10
|
||||
|
||||
# Change this to the name of the color you want for
|
||||
# the different resource bar placeholders
|
||||
resource-bar-colors:
|
||||
|
Loading…
Reference in New Issue
Block a user