From 3d2b8477700cb5fd051397379070276a1e5a1502 Mon Sep 17 00:00:00 2001 From: Lagggpixel Date: Thu, 20 Jun 2024 22:52:38 +0100 Subject: [PATCH] fix: clean up code --- .../java/plugily/projects/murdermystery/arena/Arena.java | 6 +++--- .../plugily/projects/murdermystery/arena/ArenaEvents.java | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/plugily/projects/murdermystery/arena/Arena.java b/src/main/java/plugily/projects/murdermystery/arena/Arena.java index 1440539a..ebba6e04 100644 --- a/src/main/java/plugily/projects/murdermystery/arena/Arena.java +++ b/src/main/java/plugily/projects/murdermystery/arena/Arena.java @@ -73,7 +73,7 @@ public class Arena extends PluginArena { private boolean hideChances; private boolean goldVisuals = false; private final Map gameCharacters = new EnumMap<>(CharacterType.class); - private MapRestorerManager mapRestorerManager; + private final MapRestorerManager mapRestorerManager; private ArmorStandHologram bowHologram; public Arena(String id) { @@ -391,8 +391,8 @@ public void adjustContributorValue(Role role, IUser user, int number) { user.adjustStatistic("CONTRIBUTION_" + role.name(), number); } - private Map murdererContributions = new HashMap<>(); - private Map detectiveContributions = new HashMap<>(); + private final Map murdererContributions = new HashMap<>(); + private final Map detectiveContributions = new HashMap<>(); public Map getMurdererContributions() { return murdererContributions; diff --git a/src/main/java/plugily/projects/murdermystery/arena/ArenaEvents.java b/src/main/java/plugily/projects/murdermystery/arena/ArenaEvents.java index c2a417a4..c8b0b9dc 100644 --- a/src/main/java/plugily/projects/murdermystery/arena/ArenaEvents.java +++ b/src/main/java/plugily/projects/murdermystery/arena/ArenaEvents.java @@ -254,7 +254,7 @@ public void onMurdererDamage(EntityDamageByEntityEvent e) { plugin.getRewardsHandler().performReward(attacker, plugin.getRewardsHandler().getRewardType("KILL_DETECTIVE")); } - XSound.ENTITY_PLAYER_DEATH.play(victim.getLocation(), 50, 1); + XSound.ENTITY_PLAYER_DEATH.play(victim.getLocation()); victim.damage(100.0); IUser user = plugin.getUserManager().getUser(attacker); @@ -308,11 +308,14 @@ public void onArrowDamage(EntityDamageByEntityEvent e) { return; } Arena arena = plugin.getArenaRegistry().getArena(attacker); + if (arena == null) { + return; + } //we need to set it before the victim die, because of hero character if(Role.isRole(Role.MURDERER, userVictim)) { arena.setCharacter(Arena.CharacterType.HERO, attacker); } - XSound.ENTITY_PLAYER_DEATH.play(victim.getLocation(), 50, 1); + XSound.ENTITY_PLAYER_DEATH.play(victim.getLocation()); victim.damage(100.0);