Paintball update!

This commit is contained in:
Chiss 2013-11-02 15:42:37 +11:00
parent 24723cd5e5
commit 0cbefc1280
10 changed files with 82 additions and 38 deletions

View File

@ -474,7 +474,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;
GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
GetCondition().EndCondition(player, ConditionType.CLOAK, null);
HubClock(player);

View File

@ -366,7 +366,8 @@ public abstract class Game implements Listener
}
else
{
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
//_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
}
}
@ -381,7 +382,8 @@ public abstract class Game implements Listener
}
else
{
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
//_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
}
}
}

View File

@ -21,6 +21,7 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
@ -77,7 +78,6 @@ public class Paintball extends TeamGame
});
}
/*
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
@ -90,22 +90,36 @@ public class Paintball extends TeamGame
this.GetTeamList().get(1).SetColor(ChatColor.RED);
this.GetTeamList().get(1).SetName("Nether");
}
*/
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public void ColorArmor(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Player player : GetPlayers(true))
{
CleanColorArmor(player);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void RefreshPlayers(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
for (Player other : GetPlayers(true))
{
other.hidePlayer(player);
other.showPlayer(player);
}
}
}
@EventHandler
public void HealthRegen(EntityRegainHealthEvent event)
@ -164,9 +178,6 @@ public class Paintball extends TeamGame
@EventHandler
public void PaintballDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetProjectile() == null)
return;
@ -185,6 +196,15 @@ public class Paintball extends TeamGame
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
GameTeam damageeTeam = GetTeam(damagee);
if (damageeTeam == null) return;
GameTeam damagerTeam = GetTeam(damager);
if (damagerTeam == null) return;
if (damagerTeam.equals(damageeTeam))
return;
//Color
Color color = Color.RED;
if (event.GetProjectile() instanceof Snowball)
@ -201,13 +221,15 @@ public class Paintball extends TeamGame
}
//Out
if (Color(damagee, color, count))
if (Color(damagee, count))
{
PlayerOut(damagee);
Announce(GetTeam(damagee).GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " +
GetTeam(damager).GetColor() + damager.getName());
}
for (Player player : UtilServer.getPlayers())
UtilPlayer.message(player, damageeTeam.GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " +
damagerTeam.GetColor() + damager.getName() + ChatColor.RESET + "!");
AddGems(damager, 2, "Kill", true);
}
//Hit Sound
Player player = event.GetDamagerPlayer(true);
@ -215,7 +237,9 @@ public class Paintball extends TeamGame
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f);
}
public boolean Color(Player player, Color color, int amount)
public boolean Color(Player player, int amount)
{
//Get Non-Coloured
ArrayList<ItemStack> nonColored = new ArrayList<ItemStack>();
@ -226,7 +250,7 @@ public class Paintball extends TeamGame
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
if (meta.getColor().equals(Color.WHITE))
if (meta.getColor().equals(Color.RED) || meta.getColor().equals(Color.AQUA))
nonColored.add(stack);
}
@ -239,7 +263,7 @@ public class Paintball extends TeamGame
ItemStack armor = nonColored.remove(UtilMath.r(nonColored.size()));
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(color);
meta.setColor(Color.PURPLE);
armor.setItemMeta(meta);
}
@ -369,16 +393,12 @@ public class Paintball extends TeamGame
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;
//Clean Armor
for (ItemStack stack : player.getInventory().getArmorContents())
{
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
continue;
//Items
player.getInventory().remove(Material.WATCH);
player.getInventory().remove(Material.COMPASS);
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
meta.setColor(Color.WHITE);
stack.setItemMeta(meta);
}
//Clean Armor
CleanColorArmor(player);
//Inform
UtilPlayer.message(player, F.main("Game", "You have been cleaned!"));
@ -391,6 +411,7 @@ public class Paintball extends TeamGame
public void run()
{
//Remove Invis
if (IsAlive(player))
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
//Remove Copy
@ -399,4 +420,21 @@ public class Paintball extends TeamGame
}, 4);
}
}
public void CleanColorArmor(Player player)
{
Color color = Color.RED;
if (Manager.GetColor(player) != ChatColor.RED)
color = Color.AQUA;
for (ItemStack stack : player.getInventory().getArmorContents())
{
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
continue;
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
meta.setColor(color);
stack.setItemMeta(meta);
}
}
}

View File

@ -29,7 +29,8 @@ public class PlayerCopy
//Armor
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
_ent.setCustomName(C.cWhite + C.Bold + "OUT " + ChatColor.RESET + host.GetTeam(owner).GetColor() + owner.getName());
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + host.GetTeam(owner).GetColor() + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
_ent.setCustomNameVisible(true);
//Disguise

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.paintball.kits;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
@ -24,7 +25,7 @@ public class KitShotgun extends Kit
new String[]
{
"Pump action paintball shotgun.",
C.cGold + "4 Hit Kill"
C.cGold + "8 Pellets, 4 Pellet Hits Kill"
},
new Perk[]

View File

@ -44,7 +44,7 @@ public class PerkPaintballMachineGun extends Perk
continue;
if (Recharge.Instance.usable(player, "Cool"))
player.setExp((float)Math.max(0f, player.getExp() - 0.015f));
player.setExp((float)Math.max(0f, player.getExp() - 0.020f));
}
}
@ -76,6 +76,7 @@ public class PerkPaintballMachineGun extends Perk
ShootPaintball(player, team);
/*
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
@ -83,6 +84,7 @@ public class PerkPaintballMachineGun extends Perk
ShootPaintball(player, team);
}
}, 2);
*/
}
public void ShootPaintball(Player player, GameTeam team)
@ -90,7 +92,7 @@ public class PerkPaintballMachineGun extends Perk
//Energy
if (player.getExp() >= 0.97)
return;
player.setExp((float) (player.getExp() + 0.03));
player.setExp((float) (player.getExp() + 0.025));
//Shoot
Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
@ -114,8 +116,7 @@ public class PerkPaintballMachineGun extends Perk
//proj.setVelocity(player.getLocation().getDirection().multiply(1.6).add(rand));
//proj.setShooter(player);
//Projectile proj = player.launchProjectile(EnderPearl.class);
Projectile proj = player.launchProjectile(Snowball.class);
Projectile proj = player.launchProjectile(EnderPearl.class);
proj.setVelocity(proj.getVelocity().multiply(1.6).add(rand));
//Sound

View File

@ -75,8 +75,7 @@ public class PerkPaintballRifle extends Perk
}
else
{
//Projectile proj = player.launchProjectile(EnderPearl.class);
Projectile proj = player.launchProjectile(Snowball.class);
Projectile proj = player.launchProjectile(EnderPearl.class);
proj.setVelocity(proj.getVelocity().multiply(2));
//Sound

View File

@ -68,7 +68,7 @@ public class PerkPaintballShotgun extends Perk
if (!Recharge.Instance.use(player, GetName(), 1400, true))
return;
for (int i=0 ; i<6 ; i++)
for (int i=0 ; i<8 ; i++)
{
Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
rand.multiply(0.4);
@ -83,8 +83,7 @@ public class PerkPaintballShotgun extends Perk
}
else
{
//Projectile proj = player.launchProjectile(EnderPearl.class);
Projectile proj = player.launchProjectile(Snowball.class);
Projectile proj = player.launchProjectile(EnderPearl.class);
proj.setVelocity(proj.getVelocity().multiply(1).add(rand));
//Sound

View File

@ -97,6 +97,9 @@ public class GameGemManager implements Listener
if (event.GetState() != PlayerState.OUT)
return;
if (event.GetGame().GetType() == GameType.Paintball)
return;
RewardGems(event.GetGame(), event.GetPlayer(), false);
}