Bug from JIRA

This commit is contained in:
Sam 2018-07-22 15:53:43 +01:00 committed by Alexander Meech
parent 6688e9cefc
commit a8077aae15
9 changed files with 119 additions and 107 deletions

View File

@ -67,8 +67,10 @@ public class BlowAKissEffect extends Effect
{
for (Player player : UtilPlayer.getNearby(_fixedLoc, 1.25))
{
if (player.equals(_player))
if (player.equals(_player) || UtilPlayer.isSpectator(player))
{
continue;
}
UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, player.getLocation(), 0.25f, 0.25f, 0.25f, 0.5f, 7, UtilParticle.ViewDist.NORMAL);
UtilServer.broadcast(F.main("Blow A Kiss", F.name(_player.getName()) + " blows a kiss at " + F.name(player.getName()) + "!"));

View File

@ -146,7 +146,6 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.kit.Kit;
@ -941,59 +940,63 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void StaffIncognito(IncognitoStatusChangeEvent event)
{
Player player = event.getPlayer();
if (event.getNewState()) //Is going into incognito
{
GameTeam team = _game.GetTeam(event.getPlayer());
GameTeam team = _game.GetTeam(player);
// Color their name if they are on a team
if (team != null)
{
UtilServer.broadcast(F.sys("Quit", team.GetColor() + event.getPlayer().getName()));
UtilServer.broadcast(F.sys("Quit", team.GetColor() + player.getName()));
}
else
{
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
UtilServer.broadcast(F.sys("Quit", player.getName()));
}
if (_game != null && _game.GetCountdown() > 0) //Lobby is counting down
{
// Remove Data
_game.getTeamModule().getPreferences().remove(event.getPlayer());
_game.GetPlayerKits().remove(event.getPlayer());
_game.GetPlayerGems().remove(event.getPlayer());
_game.getTeamModule().getPreferences().remove(player);
_game.GetPlayerKits().remove(player);
_game.GetPlayerGems().remove(player);
// Leave Team
if (team != null)
{
team.RemovePlayer(event.getPlayer());
team.RemovePlayer(player);
}
}
else if (_game != null && _game.GetState() != GameState.Recruit) //Game is NOT in lobby
{
addSpectator(event.getPlayer(), true);
_specList.add(event.getPlayer());
if (_game.GetTeam(event.getPlayer()) != null)
_game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.OUT);
addSpectator(player, true);
_specList.add(player);
// Leave Team
if (team != null)
{
team.RemovePlayer(player);
}
}
else //Game is in lobby
{
_specList.add(event.getPlayer());
_specList.add(player);
}
}
else //Is coming out of incognito
{
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName()));
UtilServer.broadcast(F.sys("Join", player.getName()));
if (_game != null)
{
if (!(_game.GetState() == GameState.Live || _game.GetState() == GameState.Prepare))
if (!_game.InProgress())
{
_specList.remove(event.getPlayer());
if (_game.GetTeam(event.getPlayer()) != null)
_game.SetPlayerState(event.getPlayer(), PlayerState.IN);
_specList.remove(player);
}
if (isSpectator(event.getPlayer()))
if (isSpectator(player))
{
event.show(false);
}

View File

@ -1270,7 +1270,12 @@ public class Build extends Game
@EventHandler
public void entSpawn(CreatureSpawnEvent event)
{
if (event.getSpawnReason() != SpawnReason.SPAWNER_EGG && (event.getEntityType() != EntityType.ARMOR_STAND || event.getSpawnReason() != SpawnReason.DEFAULT))
if (!InProgress())
{
return;
}
if (event.getSpawnReason() != SpawnReason.SPAWNER_EGG && (event.getEntityType() != EntityType.ARMOR_STAND || event.getSpawnReason() != SpawnReason.DEFAULT && event.getSpawnReason() != SpawnReason.CUSTOM))
{
event.setCancelled(true);
return;
@ -1723,11 +1728,6 @@ public class Build extends Game
@Override
public Location GetSpectatorLocation()
{
if (GetPlayers(true).size() > 0)
{
return UtilAlg.Random(GetPlayers(true)).getLocation().add(0, 1, 0);
}
return GetTeamList().get(0).GetSpawn();
}
@ -1831,7 +1831,10 @@ public class Build extends Game
@Override
public void EndCheck()
{
if (GetPlayers(true).isEmpty())
{
SetState(GameState.End);
}
}
@Override

View File

@ -1,5 +1,16 @@
package nautilus.game.arcade.game.games.smash.perks.magmacube;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -11,19 +22,8 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import nautilus.game.arcade.kit.Perk;
public class PerkMagmaBoost extends Perk
{
@ -49,19 +49,16 @@ public class PerkMagmaBoost extends Perk
setDesc(C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", C.cGray + "Kill bonuses can stack " + _maxStacks + " times, and reset on death.");
}
@EventHandler
public void reset(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
@Override
public void unregisteredEvents()
{
_kills.clear();
}
}
@EventHandler
public void kill(CombatDeathEvent event)
{
Player killed = (Player) event.GetEvent().getEntity();
Player killed = event.GetEvent().getEntity();
_kills.remove(killed.getUniqueId());

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
@ -126,7 +127,7 @@ public class PerkDeathsGrasp extends Perk
continue;
}
if (UtilMath.offset(player, other) < 2)
if (UtilMath.offsetSquared(player, other) < 4)
{
collide(player, other);
_live.remove(player);
@ -239,4 +240,10 @@ public class PerkDeathsGrasp extends Perk
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f);
}
@EventHandler
public void playerDeath(PlayerDeathEvent event)
{
_live.remove(event.getEntity());
}
}

View File

@ -672,10 +672,7 @@ public class SpeedBuilders extends SoloGame
if (_perfectBuild.containsKey(player))
return;
Manager.runSyncLater(new Runnable()
{
@Override
public void run()
Manager.runSyncLater(() ->
{
if (!IsLive())
return;
@ -714,8 +711,7 @@ public class SpeedBuilders extends SoloGame
UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, player);
}
}
}
}, 1L);
}, 0);
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -880,6 +876,8 @@ public class SpeedBuilders extends SoloGame
//Sometimes it stops on 0.1 and has one bar green
UtilTextBottom.displayProgress("Time Left:", 0, UtilTime.MakeStr(0), UtilServer.getPlayers());
for (Player player : GetPlayers(true))
if (_allPerfect)
{
UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Impressed!", 0, 100, 10);

View File

@ -108,22 +108,27 @@ public class PerkFletcher extends Perk
public void FletchShootBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
if (!hasPerk(player))
{
return;
}
for (int i=0 ; i<=8 ; i++)
if (isFletchedArrow(player.getInventory().getItem(i)))
for (ItemStack itemStack : player.getInventory().getContents())
{
if (isFletchedArrow(itemStack))
{
_fletchArrows.add(event.getProjectile());
((CraftArrow) event.getProjectile()).getHandle().fromPlayer = 0;
return;
}
}
}
@EventHandler
public void FletchProjectileHit(ProjectileHitEvent event)
@ -213,14 +218,7 @@ public class PerkFletcher extends Perk
@EventHandler
public void FletchDeathRemove(PlayerDeathEvent event)
{
HashSet<org.bukkit.inventory.ItemStack> remove = new HashSet<org.bukkit.inventory.ItemStack>();
for (org.bukkit.inventory.ItemStack item : event.getDrops())
if (isFletchedArrow(item))
remove.add(item);
for (org.bukkit.inventory.ItemStack item : remove)
event.getDrops().remove(item);
event.getDrops().removeIf(this::isFletchedArrow);
}
@EventHandler

View File

@ -22,6 +22,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
@ -731,6 +732,15 @@ public abstract class LobbyManager implements Listener
equipActiveKit(event.getPlayer());
}
@EventHandler
public void onInteractArmorStand(PlayerArmorStandManipulateEvent event)
{
if (_manager.GetGame() == null || _manager.GetGame().GetState() == GameState.Recruit)
{
event.setCancelled(true);
}
}
public Location getGameText()
{
return _gameText;

View File

@ -80,12 +80,6 @@ public class NewGameLobbyManager extends LobbyManager
}
}
@EventHandler
public void onInteractArmorStand(PlayerArmorStandManipulateEvent event)
{
event.setCancelled(true);
}
@Override
public void createTeams(Game game)
{