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.UtilServer;
|
||||
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.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class CombatManager extends MiniPlugin
|
||||
{
|
||||
public enum AttackReason
|
||||
{
|
||||
Attack,
|
||||
CustomWeaponName,
|
||||
DefaultWeaponName
|
||||
}
|
||||
|
||||
private NautHashMap<Player, CombatLog> _active = new NautHashMap<Player, CombatLog>();
|
||||
private NautHashMap<String, ClientCombat> _combatClients = new NautHashMap<String, ClientCombat>();
|
||||
|
||||
@ -42,6 +50,8 @@ public class CombatManager extends MiniPlugin
|
||||
|
||||
protected long ExpireTime = 15000;
|
||||
|
||||
protected AttackReason _attackReason = AttackReason.CustomWeaponName;
|
||||
|
||||
public CombatManager(JavaPlugin plugin)
|
||||
{
|
||||
super("Combat", plugin);
|
||||
@ -203,20 +213,40 @@ public class CombatManager extends MiniPlugin
|
||||
{
|
||||
Player damager = event.GetDamagerPlayer(false);
|
||||
|
||||
reason = "Fists";
|
||||
|
||||
if (damager.getItemInHand() != null)
|
||||
reason = "Attack";
|
||||
|
||||
if (_attackReason == AttackReason.DefaultWeaponName)
|
||||
{
|
||||
ItemStack itemStack = CraftItemStack.asNMSCopy(damager
|
||||
.getItemInHand());
|
||||
reason = "Fists";
|
||||
|
||||
if (itemStack != null)
|
||||
if (damager.getItemInHand() != null)
|
||||
{
|
||||
reason = CraftItemStack.asNMSCopy(
|
||||
damager.getItemInHand()).getName();
|
||||
byte data = 0;
|
||||
if (damager.getItemInHand().getData() != null)
|
||||
data = damager.getItemInHand().getData().getData();
|
||||
|
||||
reason = ItemStackFactory.Instance.GetName(damager.getItemInHand().getType(), data, false);
|
||||
}
|
||||
}
|
||||
} else if (event.GetProjectile() != null)
|
||||
else if (_attackReason == AttackReason.CustomWeaponName)
|
||||
{
|
||||
reason = "Fists";
|
||||
|
||||
if (damager.getItemInHand() != null)
|
||||
{
|
||||
ItemStack itemStack = CraftItemStack.asNMSCopy(damager
|
||||
.getItemInHand());
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
reason = CraftItemStack.asNMSCopy(
|
||||
damager.getItemInHand()).getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.GetProjectile() != null)
|
||||
{
|
||||
if (event.GetProjectile() instanceof Arrow)
|
||||
reason = "Archery";
|
||||
@ -582,4 +612,14 @@ public class CombatManager extends MiniPlugin
|
||||
|
||||
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))
|
||||
{
|
||||
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))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false);
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
//End
|
||||
|
@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
@ -68,6 +69,8 @@ public class SearchAndDestroy extends TeamGame
|
||||
DisableKillCommand = false;
|
||||
AllowParticles = false;
|
||||
DamageSelf = false;
|
||||
|
||||
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);
|
||||
}
|
||||
|
||||
public ArrayList<TeamBomb> getBombs()
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
@ -161,6 +162,7 @@ public class GameCreationManager implements Listener
|
||||
Manager.GetExplosion().SetTNTSpread(true);
|
||||
// Manager.GetAntiStack().SetEnabled(true);
|
||||
Manager.getCosmeticManager().setHideParticles(false);
|
||||
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.CustomWeaponName);
|
||||
|
||||
HashMap<String, ChatColor> pastTeams = null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user