Fix games not marked as started

This commit is contained in:
Daniel Saukel 2016-08-24 16:17:28 +02:00
parent ff7e8dbf5f
commit cf557a61e2
2 changed files with 39 additions and 33 deletions

View File

@ -170,52 +170,56 @@ public class EntityListener implements Listener {
DGroup attackerDGroup = null;
DGroup attackedDGroup = null;
if (attackerEntity instanceof LivingEntity && attackedEntity instanceof LivingEntity) {
if (attackerEntity instanceof Player && attackedEntity instanceof Player) {
attackerPlayer = (Player) attackerEntity;
attackedPlayer = (Player) attackedEntity;
if (!(attackerEntity instanceof LivingEntity) || !(attackedEntity instanceof LivingEntity)) {
return;
}
attackerDGroup = DGroup.getByPlayer(attackerPlayer);
attackedDGroup = DGroup.getByPlayer(attackedPlayer);
if (attackerEntity instanceof Player && attackedEntity instanceof Player) {
attackerPlayer = (Player) attackerEntity;
attackedPlayer = (Player) attackedEntity;
if (!pvp) {
attackerDGroup = DGroup.getByPlayer(attackerPlayer);
attackedDGroup = DGroup.getByPlayer(attackedPlayer);
if (!pvp) {
event.setCancelled(true);
return;
}
if (attackerDGroup != null && attackedDGroup != null) {
if (!friendlyFire && attackerDGroup.equals(attackedDGroup)) {
event.setCancelled(true);
}
if (attackerDGroup != null && attackedDGroup != null) {
if (!friendlyFire && attackerDGroup.equals(attackedDGroup)) {
event.setCancelled(true);
}
}
}
// Check Dogs
if (attackerEntity instanceof Player || attackedEntity instanceof Player) {
for (DGamePlayer dPlayer : DGamePlayer.getByWorld(gameWorld.getWorld())) {
if (dPlayer.getWolf() != null) {
if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(true);
return;
}
}
return;
}
}
}
// Check Dogs
if (attackerEntity instanceof Player || attackedEntity instanceof Player) {
for (DGamePlayer dPlayer : DGamePlayer.getByWorld(gameWorld.getWorld())) {
if (dPlayer.getWolf() != null) {
if (attackerEntity instanceof Player || attackedEntity instanceof Player) {
if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(true);
return;
}
} else if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(false);
if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(true);
return;
}
}
}
}
for (DGamePlayer dPlayer : DGamePlayer.getByWorld(gameWorld.getWorld())) {
if (dPlayer.getWolf() != null) {
if (attackerEntity instanceof Player || attackedEntity instanceof Player) {
if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(true);
return;
}
} else if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(false);
return;
}
}
}
}
// Deny food in Lobby

View File

@ -698,6 +698,8 @@ public class DGamePlayer extends DInstancePlayer {
respawn();
}
}
game.setStarted(true);
}
public void respawn() {