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