Add sounds and messages to basketball.

This commit is contained in:
TadahTech 2016-09-02 00:40:23 -05:00
parent 9e0bb6ff96
commit e2f974e1e6

View File

@ -1,9 +1,5 @@
package nautilus.game.arcade.game.games.basketball; package nautilus.game.arcade.game.games.basketball;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
@ -13,6 +9,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
@ -31,11 +28,11 @@ import nautilus.game.arcade.game.games.basketball.data.ThrowData;
import nautilus.game.arcade.game.games.basketball.kit.BasketballPlayerKit; import nautilus.game.arcade.game.games.basketball.kit.BasketballPlayerKit;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockPosition;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
@ -54,6 +51,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
/** /**
* Main game class for Basketball * Main game class for Basketball
*/ */
@ -318,6 +319,26 @@ public class Basketball extends TeamGame
{ {
UtilTextMiddle.display("", team.GetColor() + team.getDisplayName() + " has scored!", 0, 20 * 2, 0); UtilTextMiddle.display("", team.GetColor() + team.getDisplayName() + " has scored!", 0, 20 * 2, 0);
int points = getWorth(_throwData.getThrowOrigin(), hoop); int points = getWorth(_throwData.getThrowOrigin(), hoop);
if(_throwData.getThrower() != null)
{
String player = team.GetColor() + _throwData.getThrower().getName() + C.mBody + "";
String broad = player + " has scored a " + F.elem(points + " pointer!");
Location location = _throwData.getThrower().getLocation();
double dist = UtilMath.offset2d(_throwData.getThrowOrigin(), hoop);
if(dist <= 3)
{
broad = player + C.cGreen + " scored a layup!";
if(hoop.getY() < location.getY())
{
broad = player + C.cGreenB + " dunked on em!";
}
}
UtilServer.broadcast(broad);
}
_score.addPoint(team, points); _score.addPoint(team, points);
_ball.remove(); _ball.remove();
_ball = null; _ball = null;
@ -339,11 +360,14 @@ public class Basketball extends TeamGame
key = DataLoc.RED_SCORE_SPAWN.getKey(); key = DataLoc.RED_SCORE_SPAWN.getKey();
player.teleport(WorldData.GetCustomLocs(key).get(i % WorldData.GetCustomLocs(key).size())); player.teleport(WorldData.GetCustomLocs(key).get(i % WorldData.GetCustomLocs(key).size()));
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0f, 1.0f);
} }
} }
for (Player player : team.GetPlayers(true)) for (Player player : team.GetPlayers(true))
{ {
player.teleport(team.GetSpawn()); player.teleport(team.GetSpawn());
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0f, 1.0f);
} }
Location teleport = WorldData.GetCustomLocs(DataLoc.BLUE_UNDER_HOOP.getKey()).get(0); Location teleport = WorldData.GetCustomLocs(DataLoc.BLUE_UNDER_HOOP.getKey()).get(0);