set hub to christmas

removed snowball pickup
disabled arrows sticking into players from ALL projectiles
This commit is contained in:
Cheese 2015-12-06 14:55:28 +11:00
parent e01d30b920
commit 5aabd00972
3 changed files with 35 additions and 124 deletions

View File

@ -119,7 +119,7 @@ import org.bukkit.scoreboard.Scoreboard;
public class HubManager extends MiniClientPlugin<HubClient> public class HubManager extends MiniClientPlugin<HubClient>
{ {
// Snowman! // Snowman!
public HubType Type = HubType.Normal; public HubType Type = HubType.Christmas;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
@ -267,50 +267,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
return true; return true;
} }
@EventHandler
public void SnowballPickup(BlockDamageEvent event)
{
if (Type != HubType.Christmas)
return;
if (event.getBlock().getType() != Material.SNOW)
return;
Player player = event.getPlayer();
_gadgetManager.RemoveItem(player);
player.getInventory().setItem(3, new ItemStack(Material.SNOW_BALL, 16));
}
@EventHandler
public void SnowballHit(CustomDamageEvent event)
{
if (Type != HubType.Christmas)
return;
Projectile proj = event.GetProjectile();
if (proj == null) return;
if (!(proj instanceof Snowball))
return;
event.SetCancelled("Snowball Cancel");
if (BumpDisabled(event.GetDamageeEntity()))
return;
if (BumpDisabled(event.GetDamagerEntity(true)))
return;
UtilAction.velocity(event.GetDamageeEntity(), UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity()),
0.4, false, 0, 0.2, 1, false);
//No Portal
SetPortalDelay(event.GetDamageeEntity());
}
@EventHandler @EventHandler
public void redirectStopCommand(PlayerCommandPreprocessEvent event) public void redirectStopCommand(PlayerCommandPreprocessEvent event)
{ {
@ -663,39 +619,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
if (_scoreboardTick != 0) if (_scoreboardTick != 0)
return; return;
// int bestPig = 0;
// for (Player player : UtilServer.getPlayers())
// {
// if (player.getVehicle() != null)
// continue;
//
// int count = 0;
//
// Entity ent = player;
// while (ent.getPassenger() != null)
// {
// ent = ent.getPassenger();
// count++;
// }
//
// if (count > bestPig)
// {
// _pigStacker = player.getName();
// bestPig = count;
// }
// }
// if (bestPig == 0)
// {
// _pigStacker = "0 - Nobody";
// }
// else
// {
// _pigStacker = bestPig + " - " + _pigStacker;
//
// if (_pigStacker.length() > 16)
// _pigStacker = _pigStacker.substring(0, 16);
// }
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
//Dont Waste Time //Dont Waste Time

View File

@ -378,7 +378,7 @@ public class DamageManager extends MiniPlugin
event.GetDamageeEntity().playEffect(EntityEffect.HURT); event.GetDamageeEntity().playEffect(EntityEffect.HURT);
//Sticky Arrow //Sticky Arrow
if (event.GetCause() == DamageCause.PROJECTILE) if (event.GetCause() == DamageCause.PROJECTILE && event.GetProjectile() != null && event.GetProjectile() instanceof Arrow)
((CraftLivingEntity)event.GetDamageeEntity()).getHandle().o(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().bv() + 1); ((CraftLivingEntity)event.GetDamageeEntity()).getHandle().o(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().bv() + 1);
//Knockback //Knockback

View File

@ -13,15 +13,11 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilSound;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
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.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -35,8 +31,6 @@ import nautilus.game.arcade.game.games.snowfight.kits.KitTactician;
import nautilus.game.arcade.game.games.snowfight.kits.KitMedic; import nautilus.game.arcade.game.games.snowfight.kits.KitMedic;
import nautilus.game.arcade.game.games.snowfight.kits.KitSportsman; import nautilus.game.arcade.game.games.snowfight.kits.KitSportsman;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.SmashKit;
import net.minecraft.server.v1_8_R3.EntityFireball;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -48,10 +42,7 @@ import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFireball;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -59,31 +50,23 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
public class SnowFight extends TeamGame public class SnowFight extends TeamGame
{ {
private HashMap<Player, Integer> _tiles; private HashMap<Player, Integer> _tiles;
private boolean _meteoroids; private boolean _meteors;
private boolean _peace; private boolean _peace;
public SnowFight(ArcadeManager manager) public SnowFight(ArcadeManager manager)
@ -99,8 +82,8 @@ public class SnowFight extends TeamGame
new String[] new String[]
{ {
"Just like... kill your enemies. with snow.", "Defeat your foes with Snowballs",
"Be careful if you are on Ice your body will freeze" "Last team alive wins!"
}); });
this.HungerSet = 20; this.HungerSet = 20;
@ -111,7 +94,7 @@ public class SnowFight extends TeamGame
this.BlockPlace = true; this.BlockPlace = true;
this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId())); this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId()));
this._tiles = new HashMap<Player, Integer>(); this._tiles = new HashMap<Player, Integer>();
this._meteoroids = false; this._meteors = false;
this._peace = false; this._peace = false;
} }
@ -160,39 +143,42 @@ public class SnowFight extends TeamGame
} }
@EventHandler @EventHandler
public void Meteor(UpdateEvent event) { public void Meteor(UpdateEvent event)
if(event.getType() != UpdateType.TWOSEC) {
if(event.getType() != UpdateType.FAST)
return; return;
if (!IsLive()) if (!IsLive())
return; return;
if(System.currentTimeMillis() <= getGameLiveTime() + (15 * 1000)) if (System.currentTimeMillis() <= getGameLiveTime() + 10000)
{
UtilTextMiddle.display(C.cGreen + "Prepare", "Battle in " + UtilTime.MakeStr((getGameLiveTime() + 10000) - System.currentTimeMillis()), 0, 60, 20, UtilServer.getPlayers());
return; return;
}
if (!_peace) if (!_peace)
{ {
for(Player player : GetPlayers(false)) for(Player player : GetPlayers(false))
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
UtilTextMiddle.display(C.cGold + C.Bold + "Peace Phase ended", "Kill your enemies", player);
} UtilTextMiddle.display(C.cRed + "FIGHT", "Throw your Snowballs!", 0, 60, 20, UtilServer.getPlayers());
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "Peace Phase ended");
_peace = true; _peace = true;
} }
if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000)) if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000))
return; return;
if(!_meteoroids) if(!_meteors)
{ {
for(Player player : GetPlayers(false)) for(Player player : GetPlayers(false))
{ {
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
UtilTextMiddle.display(C.cGold + C.Bold + "ICE METEOROIDS!!!", "Avoid the Ice Fields", player); UtilTextMiddle.display(C.cAqua + C.Bold + "Ice Meteors", "Avoid the Ice Fields!", player);
} }
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "METEOROIDS START FALLING!");
_meteoroids = true; _meteors = true;
} }
makeMeteor(); makeMeteor();
} }
@ -345,12 +331,12 @@ public class SnowFight extends TeamGame
// Lower // Lower
if (height >= snowLevel) if (height >= snowLevel)
{ {
block.setTypeIdAndData(0, (byte) 0, true); block.setTypeIdAndData(0, (byte) 0, false);
SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel); SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel);
} }
else else
{ {
block.setTypeIdAndData(78, (byte) (snowLevel - height - 1), true); block.setTypeIdAndData(78, (byte) (snowLevel - height - 1), false);
} }
} }
@ -456,7 +442,7 @@ public class SnowFight extends TeamGame
if (i++ % 6 == 0) if (i++ % 6 == 0)
{ {
fallingblock.getWorld().playSound(fallingblock.getLocation(), Sound.CAT_HISS, 1.3F, 0F); fallingblock.getWorld().playSound(fallingblock.getLocation(), Sound.CAT_HISS, 0.7F, 0F);
} }
} }
else else
@ -498,10 +484,11 @@ public class SnowFight extends TeamGame
explosion.setDropItems(false); explosion.setDropItems(false);
explosion.setBlocksDamagedEqually(true); explosion.setBlocksDamagedEqually(true);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 1.0F, 1.0F, 1.0F, 1, 3, ViewDist.MAX, UtilServer.getPlayers()); //Effect
for(Player player : UtilServer.getPlayers()) { UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
for(Player player : UtilServer.getPlayers())
player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1); player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
}
boolean fall = true; boolean fall = true;
@ -510,7 +497,7 @@ public class SnowFight extends TeamGame
if(player instanceof Player) if(player instanceof Player)
{ {
Player damagee = (Player) player; Player damagee = (Player) player;
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false)); Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteor", "Ice Meteor", false));
} }
} }
@ -519,6 +506,7 @@ public class SnowFight extends TeamGame
if(block.getType() != Material.AIR) if(block.getType() != Material.AIR)
{ {
block.setType(Material.ICE); block.setType(Material.ICE);
if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR) if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
{ {
// to reduce lag // to reduce lag
@ -611,7 +599,7 @@ public class SnowFight extends TeamGame
for (GameTeam team : this.GetTeamList()) for (GameTeam team : this.GetTeamList())
{ {
Scoreboard.Write(team.GetColor() + C.Bold + team.GetName()); Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
Scoreboard.Write(team.GetColor() + "Alive " + team.GetPlayers(true).size()); Scoreboard.Write(team.GetColor() + "" + team.GetPlayers(true).size() + " Alive");
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
} }
} }
@ -620,13 +608,13 @@ public class SnowFight extends TeamGame
if (time > 0) if (time > 0)
{ {
Scoreboard.Write(C.cYellow + C.Bold + "Meteoroids:"); Scoreboard.Write(C.cYellow + C.Bold + "Meteors");
if(IsLive()) if(IsLive())
Scoreboard.Write(UtilTime.MakeStr(time, 0)); Scoreboard.Write(UtilTime.MakeStr(time, 0));
} }
else else
{ {
Scoreboard.Write(C.cGold + C.Bold + "Meteoroids!"); Scoreboard.Write(C.cGold + C.Bold + "Meteors!");
} }
Scoreboard.Draw(); Scoreboard.Draw();