Unify combat tag checking
This commit is contained in:
parent
d5355ab757
commit
9daa46bb4a
@ -282,7 +282,7 @@ public class ClansUtility
|
||||
|
||||
public boolean isSafe(Player player)
|
||||
{
|
||||
if (!UtilTime.elapsed(_clansManager.getCombatManager().Get(player).GetLastDamaged(), Spawn.COMBAT_TAG_DURATION)) return false;
|
||||
if (!UtilTime.elapsed(_clansManager.getCombatManager().Get(player).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION)) return false;
|
||||
|
||||
return isSafe(player.getLocation());
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class KillCommand extends CommandBase<ClansManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!UtilTime.elapsed(Plugin.getCombatManager().Get(caller).GetLastDamaged(), Spawn.COMBAT_TAG_DURATION))
|
||||
if (!UtilTime.elapsed(Plugin.getCombatManager().Get(caller).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in combat."));
|
||||
return;
|
||||
|
@ -40,7 +40,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
|
@ -610,15 +610,13 @@ public class Gameplay extends MiniPlugin
|
||||
|
||||
final byte data = block.getData();
|
||||
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
public void run()
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), () ->
|
||||
{
|
||||
Material mat = block.getRelative(BlockFace.DOWN).getType();
|
||||
if (mat == Material.DIRT || mat == Material.GRASS)
|
||||
{
|
||||
Material mat = block.getRelative(BlockFace.DOWN).getType();
|
||||
if (mat == Material.DIRT || mat == Material.GRASS)
|
||||
{
|
||||
block.setType(Material.SAPLING);
|
||||
block.setData(data);
|
||||
}
|
||||
block.setType(Material.SAPLING);
|
||||
block.setData(data);
|
||||
}
|
||||
}, 20 * 10);
|
||||
}
|
||||
@ -637,7 +635,9 @@ public class Gameplay extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
// Self
|
||||
@ -659,6 +659,8 @@ public class Gameplay extends MiniPlugin
|
||||
|
||||
if (block.getTypeId() == 0) block.setType(Material.FIRE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -51,7 +51,6 @@ public class Spawn extends MiniPlugin
|
||||
{
|
||||
public static final int SPAWN_RADIUS = 32;
|
||||
public static final int SHOP_RADIUS = 48;
|
||||
public static final String COMBAT_TAG_NAME = "Unsafe";
|
||||
public static final long COMBAT_TAG_DURATION = 15000;
|
||||
public static final Location ORIGIN = new Location(getSpawnWorld(), 0, 0, 0);
|
||||
|
||||
@ -201,7 +200,6 @@ public class Spawn extends MiniPlugin
|
||||
+ ChatColor.YELLOW + F.time(UtilTime.convertString(COMBAT_TAG_DURATION - duration, 1, TimeUnit.FIT));
|
||||
|
||||
UtilTextMiddle.display(null, message, 0, 20, 0, cur);
|
||||
_clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1.d, 0, false, Material.FIRE, (byte)0, true);
|
||||
playUnsafeParticles(cur);
|
||||
}
|
||||
else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 600))
|
||||
@ -490,16 +488,14 @@ public class Spawn extends MiniPlugin
|
||||
|
||||
public boolean isCombatTagged(Player player)
|
||||
{
|
||||
return _clansManager.getCondition().HasCondition(player, ConditionType.CUSTOM, COMBAT_TAG_NAME);
|
||||
return !UtilTime.elapsed(_clansManager.getCombatManager().Get(player).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION);
|
||||
}
|
||||
|
||||
public void teleport(final Player player, final Location location, int delay)
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.teleport(location);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () ->
|
||||
{
|
||||
player.teleport(location);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
@ -521,7 +517,9 @@ public class Spawn extends MiniPlugin
|
||||
public void playDatMusicALLDAYLONG(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_songEastLast, _songEastLength))
|
||||
{
|
||||
@ -542,4 +540,4 @@ public class Spawn extends MiniPlugin
|
||||
{
|
||||
return _clansManager;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user