Fix players being affected by velocity inside on the spawn island

This commit is contained in:
Sam 2017-04-23 14:42:26 +01:00
parent 09300b499f
commit 02ffec8618

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.modules.training;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.*;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
@ -302,6 +303,24 @@ public class TrainingGameModule extends Module
}
}
@EventHandler
public void entityVelocity(EntityVelocityChangeEvent event)
{
Entity entity = event.getEntity();
if (!(entity instanceof Player))
{
return;
}
Player player = (Player) entity;
if (!_damageFunction.apply(player))
{
event.setCancelled(true);
}
}
@EventHandler
public void giveReturnToSpawn(UpdateEvent event)
{