wtf
This commit is contained in:
parent
55017fb201
commit
da2fe2dbc1
@ -5,9 +5,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
@ -91,13 +89,4 @@ public class RandomListeners implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(event.getEntity().getUniqueId());
|
||||
|
||||
if (playerData.getPlayerState() != PlayerState.PLAYING) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import rip.tilly.bedwars.events.PlayerKillEvent;
|
||||
import rip.tilly.bedwars.game.Game;
|
||||
import rip.tilly.bedwars.game.GameState;
|
||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||
import rip.tilly.bedwars.playerdata.PlayerState;
|
||||
import rip.tilly.bedwars.utils.CC;
|
||||
|
||||
public class DamageListener implements Listener {
|
||||
@ -85,6 +86,11 @@ public class DamageListener implements Listener {
|
||||
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId());
|
||||
PlayerData damagerData = this.plugin.getPlayerDataManager().getPlayerData(damager.getUniqueId());
|
||||
|
||||
if (playerData.getPlayerState() != PlayerState.PLAYING || damagerData.getPlayerState() != PlayerState.PLAYING) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Game game = this.plugin.getGameManager().getGame(player.getUniqueId());
|
||||
if (game == null) {
|
||||
event.setDamage(0);
|
||||
|
Loading…
Reference in New Issue
Block a user