you now get levels for kills/assists

fixed scoreboard bug
This commit is contained in:
Cheese 2015-06-26 19:12:11 +10:00
parent b0019242e7
commit 62a7fd6a99

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
@ -27,6 +28,8 @@ import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -1300,4 +1303,48 @@ public class Skywars extends SoloGame
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, proj.getLocation(), 0f, 0f, 0f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers());
}
}
@EventHandler
public void killLevelReward(CombatDeathEvent event)
{
if (!Manager.IsRewardGems())
return;
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
Player killed = (Player)event.GetEvent().getEntity();
if (event.GetLog().GetKiller() != null)
{
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer != null && !killer.equals(killed))
{
//Kill
killer.giveExpLevels(2);
killer.playSound(killer.getLocation(), Sound.LEVEL_UP, 1f, 1f);
}
}
for (CombatComponent log : event.GetLog().GetAttackers())
{
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
continue;
Player assist = UtilPlayer.searchExact(log.GetName());
//Assist
if (assist != null)
{
assist.giveExpLevels(1);
assist.playSound(assist.getLocation(), Sound.ORB_PICKUP, 1f, 1f);
}
}
}
}