added func to change attackreason for combatmanager
This commit is contained in:
parent
7e6b6bd1b2
commit
184c6cb4ba
@ -29,12 +29,20 @@ import mineplex.core.common.util.UtilEvent;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.minecraft.game.core.combat.event.ClearCombatEvent;
|
import mineplex.minecraft.game.core.combat.event.ClearCombatEvent;
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class CombatManager extends MiniPlugin
|
public class CombatManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
|
public enum AttackReason
|
||||||
|
{
|
||||||
|
Attack,
|
||||||
|
CustomWeaponName,
|
||||||
|
DefaultWeaponName
|
||||||
|
}
|
||||||
|
|
||||||
private NautHashMap<Player, CombatLog> _active = new NautHashMap<Player, CombatLog>();
|
private NautHashMap<Player, CombatLog> _active = new NautHashMap<Player, CombatLog>();
|
||||||
private NautHashMap<String, ClientCombat> _combatClients = new NautHashMap<String, ClientCombat>();
|
private NautHashMap<String, ClientCombat> _combatClients = new NautHashMap<String, ClientCombat>();
|
||||||
|
|
||||||
@ -42,6 +50,8 @@ public class CombatManager extends MiniPlugin
|
|||||||
|
|
||||||
protected long ExpireTime = 15000;
|
protected long ExpireTime = 15000;
|
||||||
|
|
||||||
|
protected AttackReason _attackReason = AttackReason.CustomWeaponName;
|
||||||
|
|
||||||
public CombatManager(JavaPlugin plugin)
|
public CombatManager(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
super("Combat", plugin);
|
super("Combat", plugin);
|
||||||
@ -203,6 +213,24 @@ public class CombatManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
Player damager = event.GetDamagerPlayer(false);
|
Player damager = event.GetDamagerPlayer(false);
|
||||||
|
|
||||||
|
|
||||||
|
reason = "Attack";
|
||||||
|
|
||||||
|
if (_attackReason == AttackReason.DefaultWeaponName)
|
||||||
|
{
|
||||||
|
reason = "Fists";
|
||||||
|
|
||||||
|
if (damager.getItemInHand() != null)
|
||||||
|
{
|
||||||
|
byte data = 0;
|
||||||
|
if (damager.getItemInHand().getData() != null)
|
||||||
|
data = damager.getItemInHand().getData().getData();
|
||||||
|
|
||||||
|
reason = ItemStackFactory.Instance.GetName(damager.getItemInHand().getType(), data, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_attackReason == AttackReason.CustomWeaponName)
|
||||||
|
{
|
||||||
reason = "Fists";
|
reason = "Fists";
|
||||||
|
|
||||||
if (damager.getItemInHand() != null)
|
if (damager.getItemInHand() != null)
|
||||||
@ -216,7 +244,9 @@ public class CombatManager extends MiniPlugin
|
|||||||
damager.getItemInHand()).getName();
|
damager.getItemInHand()).getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.GetProjectile() != null)
|
}
|
||||||
|
}
|
||||||
|
else if (event.GetProjectile() != null)
|
||||||
{
|
{
|
||||||
if (event.GetProjectile() instanceof Arrow)
|
if (event.GetProjectile() instanceof Arrow)
|
||||||
reason = "Archery";
|
reason = "Archery";
|
||||||
@ -582,4 +612,14 @@ public class CombatManager extends MiniPlugin
|
|||||||
|
|
||||||
player.sendMessage(F.main(getName(), nameBuilder.toString()));
|
player.sendMessage(F.main(getName(), nameBuilder.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUseWeaponName(AttackReason var)
|
||||||
|
{
|
||||||
|
_attackReason = var;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AttackReason getUseWeapoName()
|
||||||
|
{
|
||||||
|
return _attackReason;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1332,12 +1332,12 @@ public abstract class Game implements Listener
|
|||||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||||
{
|
{
|
||||||
for (Player player : team.GetPlayers(false))
|
for (Player player : team.GetPlayers(false))
|
||||||
AddGems(player, 10, "Winning Team", false);
|
AddGems(player, 10, "Winning Team", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : team.GetPlayers(false))
|
for (Player player : team.GetPlayers(false))
|
||||||
if (player.isOnline())
|
if (player.isOnline())
|
||||||
AddGems(player, 10, "Participation", false);
|
AddGems(player, 10, "Participation", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//End
|
//End
|
||||||
|
@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilTextMiddle;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
|
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
@ -68,6 +69,8 @@ public class SearchAndDestroy extends TeamGame
|
|||||||
DisableKillCommand = false;
|
DisableKillCommand = false;
|
||||||
AllowParticles = false;
|
AllowParticles = false;
|
||||||
DamageSelf = false;
|
DamageSelf = false;
|
||||||
|
|
||||||
|
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<TeamBomb> getBombs()
|
public ArrayList<TeamBomb> getBombs()
|
||||||
|
@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import mineplex.core.timing.TimingManager;
|
import mineplex.core.timing.TimingManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
@ -161,6 +162,7 @@ public class GameCreationManager implements Listener
|
|||||||
Manager.GetExplosion().SetTNTSpread(true);
|
Manager.GetExplosion().SetTNTSpread(true);
|
||||||
// Manager.GetAntiStack().SetEnabled(true);
|
// Manager.GetAntiStack().SetEnabled(true);
|
||||||
Manager.getCosmeticManager().setHideParticles(false);
|
Manager.getCosmeticManager().setHideParticles(false);
|
||||||
|
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.CustomWeaponName);
|
||||||
|
|
||||||
HashMap<String, ChatColor> pastTeams = null;
|
HashMap<String, ChatColor> pastTeams = null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user