Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/master

This commit is contained in:
Jonathan Williams 2013-09-17 15:52:16 -07:00
commit ae00d3df18
34 changed files with 924 additions and 227 deletions

View File

@ -23,6 +23,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -191,6 +192,18 @@ public class Punish extends MiniPlugin
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.LOWEST)
public void PunishChatEvent(PlayerCommandPreprocessEvent event)
{
PunishClient client = GetClient(event.getPlayer().getName());
if (client != null && client.IsMuted())
{
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
event.setCancelled(true);
}
}
public void Help(Player caller) public void Help(Player caller)
{ {

View File

@ -42,10 +42,13 @@ public class TextCreator extends MiniPlugin
arcadeGames = new String[] arcadeGames = new String[]
{ {
"A BARBARIANS LIFE",
"ONE IN THE QUIVER", "ONE IN THE QUIVER",
"ZOMBIE SURVIVAL", "DRAGON ESCAPE",
"MILK THE COW",
"SUPER SPLEEF", "SUPER SPLEEF",
"TURF FORTS", "TURF FORTS",
"DEATH TAG",
"DRAGONS", "DRAGONS",
"RUNNER" "RUNNER"
}; };

View File

@ -20,8 +20,6 @@ import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@ -435,22 +433,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
} }
@EventHandler(priority = EventPriority.LOWEST)
public void HubClockInteract(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.WATCH)
return;
if (_game != null && _game.IsAlive(player))
return;
_portal.SendPlayerToServer(player, "Lobby");
}
public boolean IsAlive(Player player) public boolean IsAlive(Player player)
{ {

View File

@ -48,7 +48,7 @@ public class GameFactory
else if (gameType == GameType.SnowFight) return new SnowFight(_manager); else if (gameType == GameType.SnowFight) return new SnowFight(_manager);
else if (gameType == GameType.Smash) return new SuperSmash(_manager); else if (gameType == GameType.Smash) return new SuperSmash(_manager);
else if (gameType == GameType.Spleef) return new Spleef(_manager); else if (gameType == GameType.Spleef) return new Spleef(_manager);
else if (gameType == GameType.TurfForts) return new TurfForts(_manager); else if (gameType == GameType.TurfWars) return new TurfForts(_manager);
else if (gameType == GameType.UHC) return new UHC(_manager); else if (gameType == GameType.UHC) return new UHC(_manager);
else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager); else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager);
else return null; else return null;

View File

@ -11,6 +11,7 @@ public enum GameType
Dragons("Dragons"), Dragons("Dragons"),
Evolution("Evolution"), Evolution("Evolution"),
Horse("Horseback"), Horse("Horseback"),
HungerGames("Survival Games"),
MineWare("MineWare"), MineWare("MineWare"),
MilkCow("Milk the Cow"), MilkCow("Milk the Cow"),
Quiver("One in the Quiver"), Quiver("One in the Quiver"),
@ -18,7 +19,7 @@ public enum GameType
Smash("Super Smash Mobs"), Smash("Super Smash Mobs"),
SnowFight("Snow Fight"), SnowFight("Snow Fight"),
Spleef("Super Spleef"), Spleef("Super Spleef"),
TurfForts("Turf Forts"), TurfWars("Turf Wars"),
UHC("Ultra Hardcore"), UHC("Ultra Hardcore"),
ZombieSurvival("Zombie Survival"); ZombieSurvival("Zombie Survival");

View File

@ -162,6 +162,8 @@ public abstract class Game implements Listener
//Addons //Addons
public boolean CompassEnabled = false; public boolean CompassEnabled = false;
public boolean SoupEnabled = true; public boolean SoupEnabled = true;
public double GemMultiplier = 1;
//Gameplay Data //Gameplay Data
public HashMap<Location, Player> PrivateBlockMap = new HashMap<Location, Player>(); public HashMap<Location, Player> PrivateBlockMap = new HashMap<Location, Player>();

View File

@ -1,19 +1,17 @@
package nautilus.game.arcade.game.games.barbarians; package nautilus.game.arcade.game.games.barbarians;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilPlayer;
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 nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.barbarians.kits.*; import nautilus.game.arcade.game.games.barbarians.kits.*;
@ -21,9 +19,6 @@ import nautilus.game.arcade.kit.Kit;
public class Barbarians extends SoloGame public class Barbarians extends SoloGame
{ {
private GameTeam _barbs;
private GameTeam _pigs;
public Barbarians(ArcadeManager manager) public Barbarians(ArcadeManager manager)
{ {
super(manager, GameType.Barbarians, super(manager, GameType.Barbarians,
@ -33,18 +28,16 @@ public class Barbarians extends SoloGame
new KitBrute(manager), new KitBrute(manager),
new KitArcher(manager), new KitArcher(manager),
new KitBomber(manager), new KitBomber(manager),
new KitPig(manager)
}, },
new String[] new String[]
{ {
"Free for all fight to the death!", "Free for all fight to the death!",
"Wooden blocks are breakable.", "Wooden blocks are breakable.",
"Attack people to restore hunger!",
"Last player alive wins!" "Last player alive wins!"
}); });
this.DeathOut = false;
this.HungerSet = 20;
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
this.CompassEnabled = true; this.CompassEnabled = true;
@ -68,67 +61,16 @@ public class Barbarians extends SoloGame
this.BlockBreakAllow.add(136); this.BlockBreakAllow.add(136);
} }
@Override
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
_barbs = this.GetTeamList().get(0);
_barbs.SetName("Barbarians");
//Undead Team
_pigs = new GameTeam("Dead", ChatColor.RED, _barbs.GetSpawns());
GetTeamList().add(_pigs);
_pigs.SetVisible(false);
RestrictKits();
}
@Override
public GameTeam ChooseTeam(Player player)
{
return _barbs;
}
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
if (_barbs.HasPlayer(event.getEntity()))
SetChaser(event.getEntity());
}
public void SetChaser(Player player)
{
if (!GetPlaces().contains(player))
GetPlaces().add(0, player);
SetPlayerTeam(player, _pigs);
//Kit
Kit newKit = GetKits()[3];
SetKit(player, newKit, false);
newKit.ApplyKit(player);
//Refresh
for (Player other : UtilServer.getPlayers())
{
other.hidePlayer(player);
other.showPlayer(player);
}
}
@Override @Override
public void EndCheck() public void EndCheck()
{ {
if (!IsLive()) if (!IsLive())
return; return;
if (_barbs.GetPlayers(true).size() <= 1) if (GetPlayers(true).size() <= 1)
{ {
if (_barbs.GetPlayers(true).size() == 1) if (GetPlayers(true).size() == 1)
GetPlaces().add(0, GetPlayers(true).get(0)); GetPlaces().add(0, GetPlayers(true).get(0));
if (GetPlaces().size() >= 1) if (GetPlaces().size() >= 1)
@ -149,26 +91,6 @@ public class Barbarians extends SoloGame
} }
} }
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (_barbs == null || _pigs == null)
return;
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_barbs.GetColor() + _barbs.GetName())).setScore(_barbs.GetPlayers(true).size());
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_pigs.GetColor() + _pigs.GetName())).setScore(_pigs.GetPlayers(true).size());
}
@Override
public boolean CanJoinTeam(GameTeam team)
{
return (team.GetColor() != ChatColor.RED);
}
@EventHandler @EventHandler
public void BlockDamage(BlockDamageEvent event) public void BlockDamage(BlockDamageEvent event)
{ {
@ -181,14 +103,33 @@ public class Barbarians extends SoloGame
event.setCancelled(true); event.setCancelled(true);
} }
@Override @EventHandler
public double GetKillsGems(Player killer, Player killed, boolean assist) public void Hunger(UpdateEvent event)
{ {
if (GetTeam(killed).equals(_barbs)) if (event.getType() != UpdateType.SLOW)
{ return;
return 4;
}
return 0; if (!IsLive())
return;
for (Player player : GetPlayers(true))
{
if (player.getFoodLevel() <= 0)
{
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.STARVATION, 1, false, true, false,
"Starvation", GetName());
}
UtilPlayer.hunger(player, -2);
}
}
@EventHandler
public void HungerRestore(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
UtilPlayer.hunger(damager, 2);
} }
} }

View File

@ -27,7 +27,7 @@ public class KitBomber extends Kit
new Perk[] new Perk[]
{ {
new PerkBomber(8, -1, 30), new PerkBomber(8, 2, -1),
new PerkLeap("Leap", 1, 1, 8000) new PerkLeap("Leap", 1, 1, 8000)
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,

View File

@ -1,44 +0,0 @@
package nautilus.game.arcade.game.games.barbarians.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguisePig;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDamageSet;
public class KitPig extends SmashKit
{
public KitPig(ArcadeManager manager)
{
super(manager, "Pig", KitAvailability.Hide,
new String[]
{
},
new Perk[]
{
new PerkDamageSet(0),
},
EntityType.PIG,
new ItemStack(Material.PORK));
}
@Override
public void GiveItems(Player player)
{
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.SetName(C.cGray + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -136,6 +136,8 @@ public class Bridge extends TeamGame implements OreObsfucation
this.CompassEnabled = true; this.CompassEnabled = true;
this.DeathDropItems = true; this.DeathDropItems = true;
this.GemMultiplier = 2.5;
} }
@EventHandler @EventHandler

View File

@ -176,6 +176,13 @@ public class DragonEscape extends SoloGame
int preNode = (int)(score.Score/10000); int preNode = (int)(score.Score/10000);
int postNode = (int)(playerScore/10000); int postNode = (int)(playerScore/10000);
//Shortcut
if (preNode - postNode >= 3)
{
//Super Backtrack!
continue;
}
//Shortcut //Shortcut
if (postNode - preNode >= 2) if (postNode - preNode >= 2)
{ {

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.hungergames;
import org.bukkit.Effect;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.hungergames.kit.*;
import nautilus.game.arcade.kit.Kit;
public class HungerGames extends SoloGame
{
public HungerGames(ArcadeManager manager)
{
super(manager, GameType.HungerGames,
new Kit[]
{
new KitBeserker(manager),
new KitBomber(manager),
},
new String[]
{
"Scavenge supplies to survive.",
"Playable area shrinks over time!",
"Last player alive wins!"
});
this.DamageSelf = true;
this.DamageTeamSelf = true;
this.BlockBreak = true;
this.CompassEnabled = true;
this.GemMultiplier = 2;
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
return 4;
}
@EventHandler
public void BlockBreak(BlockBreakEvent event)
{
event.setCancelled(true);
event.getBlock().setTypeId(0);
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getTypeId());
}
}

View File

@ -0,0 +1,41 @@
package nautilus.game.arcade.game.games.hungergames.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitArcher extends Kit
{
public KitArcher(ArcadeManager manager)
{
super(manager, "Archer", KitAvailability.Blue,
new String[]
{
"Highly trained with a bow, probably an elf or something..."
},
new Perk[]
{
new PerkFletcher(20, 3, true),
new PerkBarrage(5, 250, true),
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
}
}

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.hungergames.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitAssassin extends Kit
{
public KitAssassin(ArcadeManager manager)
{
super(manager, "Assassin", KitAvailability.Green,
new String[]
{
},
new Perk[]
{
new PerkNotFinished()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,40 @@
package nautilus.game.arcade.game.games.hungergames.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitBeserker extends Kit
{
public KitBeserker(ArcadeManager manager)
{
super(manager, "Beserker", KitAvailability.Free,
new String[]
{
"Agile warrior trained in the ways axe combat."
},
new Perk[]
{
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000),
new PerkAxeman(),
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.hungergames.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitBomber extends Kit
{
public KitBomber(ArcadeManager manager)
{
super(manager, "Bomber", KitAvailability.Blue,
new String[]
{
"Crazy bomb throwing guy."
},
new Perk[]
{
new PerkBomber(30, 2, -1)
},
EntityType.ZOMBIE,
new ItemStack(Material.TNT));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.hungergames.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitKnight extends Kit
{
public KitKnight(ArcadeManager manager)
{
super(manager, "Knight", KitAvailability.Green,
new String[]
{
},
new Perk[]
{
new PerkNotFinished()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,40 @@
package nautilus.game.arcade.game.games.hungergames.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitMammoth extends Kit
{
public KitMammoth(ArcadeManager manager)
{
super(manager, "Brawler", KitAvailability.Green,
new String[]
{
"Giant and muscular, easily smacks others around."
},
new Perk[]
{
new PerkMammoth(),
new PerkIronSkin(1)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -17,6 +17,7 @@ import org.bukkit.entity.Pig;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerItemConsumeEvent;
@ -25,6 +26,7 @@ import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
@ -33,6 +35,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
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.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
@ -74,14 +77,17 @@ public class MilkCow extends SoloGame
new String[] new String[]
{ {
"Each Farmer must gather milk.", "Farmers get 1 point for drinking milk.",
"Drink 15 buckets of milk to win!", "You lose 5 points for dying!",
"", "",
"Cow must stop his herd from being milked.", "Cows get 1 point for killing farmers.",
"Kill all the farmers to win!" "Defend your herd to stop farmers!",
"",
"First player to 15 points wins!"
}); });
this.CompassEnabled = true; this.CompassEnabled = true;
this.DeathOut = false;
_scoreObj = GetScoreboard().registerNewObjective("Milk", "dummy"); _scoreObj = GetScoreboard().registerNewObjective("Milk", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
@ -218,11 +224,20 @@ public class MilkCow extends SoloGame
if (UtilMath.offset(cow, host) > 6) if (UtilMath.offset(cow, host) > 6)
{ {
nav.a(host.getLocation().getX(), host.getLocation().getY(),host.getLocation().getZ(), 1.6f); if (UtilMath.offset(cow, host) > 16)
{
Location target = cow.getLocation();
target.add(UtilAlg.getTrajectory(cow, host).multiply(16));
nav.a(target.getX(), target.getY(), target.getZ(), 1.8f);
}
else
nav.a(host.getLocation().getX(), host.getLocation().getY(),host.getLocation().getZ(), 1.4f);
} }
} }
while (_herd.size() < 8) while (_herd.size() < 5)
{ {
this.CreatureAllowOverride = true; this.CreatureAllowOverride = true;
Cow cow = host.getWorld().spawn(host.getLocation(), Cow.class); Cow cow = host.getWorld().spawn(host.getLocation(), Cow.class);
@ -327,6 +342,28 @@ public class MilkCow extends SoloGame
this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true); this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true);
} }
@EventHandler
public void LoseMilk(PlayerDeathEvent event)
{
SetScore(event.getEntity(), Math.max(0, GetScore(event.getEntity()) - 5));
}
@EventHandler
public void KillFarmer(CombatDeathEvent event)
{
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null) return;
//Score
SetScore(player, GetScore(player)+1);
}
public void SetScore(Player player, double level) public void SetScore(Player player, double level)
{ {
@ -479,12 +516,12 @@ public class MilkCow extends SoloGame
@Override @Override
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
int cows = (int)(GetPlayers(true).size()/5);
if (team.GetColor() == ChatColor.RED) if (team.GetColor() == ChatColor.RED)
{ return team.GetSize() < cows;
return team.GetSize() == 0;
} return team.GetSize() < GetPlayers(true).size() - cows;
return true;
} }
@EventHandler @EventHandler

View File

@ -28,11 +28,11 @@ public class KitCow extends SmashKit
new Perk[] new Perk[]
{ {
new PerkDamageSet(5), new PerkDamageSet(4),
new PerkKnockbackMultiplier(4), new PerkKnockbackMultiplier(4),
new PerkCharge(), new PerkCharge(),
new PerkCowBomb(), new PerkCowBomb(),
new PerkBodySlam(6, 5), new PerkSeismicCow(),
}, },
EntityType.COW, EntityType.COW,
null); null);
@ -42,7 +42,7 @@ public class KitCow extends SmashKit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Bomb", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Bomb",
new String[] new String[]
{ {
@ -52,7 +52,7 @@ public class KitCow extends SmashKit
})); }));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam",
new String[] new String[]
{ {

View File

@ -8,6 +8,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
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.BlockFadeEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
@ -59,6 +60,7 @@ public class SuperSmash extends SoloGame
new KitKnight(manager), new KitKnight(manager),
new KitSkySquid(manager), new KitSkySquid(manager),
new KitWitherSkeleton(manager), new KitWitherSkeleton(manager),
//new KitWither(manager),
}, },
@ -305,4 +307,10 @@ public class SuperSmash extends SoloGame
{ {
return 4; return 4;
} }
@EventHandler
public void BlockFade(BlockFadeEvent event)
{
event.setCancelled(true);
}
} }

View File

@ -0,0 +1,117 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkSkullShot;
public class KitWither extends SmashKit
{
public KitWither(ArcadeManager manager)
{
super(manager, "Wither", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.2, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSkullShot(),
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(new ItemStack(Material.ARROW));
ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1);
player.getInventory().setHelmet(head);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.BLACK);
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
}
@EventHandler
public void InvisibilityUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : UtilServer.getPlayers())
{
if (!HasKit(player))
continue;
if (player.getInventory().getChestplate() == null)
continue;
Manager.GetCondition().Factory().Invisible("Wither Invis", player, player, 1.9, 0, false, false, false);
}
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : ""));
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
Manager.GetCondition().Factory().Invisible("Kit Invis", entity, entity, 7777, 0, false, false, false);
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1);
ent.getEquipment().setHelmet(head);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.BLACK);
armor.setItemMeta(meta);
ent.getEquipment().setChestplate(armor);
}
}

View File

@ -71,7 +71,7 @@ public class TurfForts extends TeamGame
public TurfForts(ArcadeManager manager) public TurfForts(ArcadeManager manager)
{ {
super(manager, GameType.TurfForts, super(manager, GameType.TurfWars,
new Kit[] new Kit[]
{ {
@ -173,7 +173,8 @@ public class TurfForts extends TeamGame
MapUtil.QuickChangeBlockAt(loc, 159, (byte)14); MapUtil.QuickChangeBlockAt(loc, 159, (byte)14);
for (int i=1 ; i<6 ; i++) for (int i=1 ; i<6 ; i++)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0); if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
} }
@ -184,7 +185,8 @@ public class TurfForts extends TeamGame
MapUtil.QuickChangeBlockAt(loc, 159, (byte)14); MapUtil.QuickChangeBlockAt(loc, 159, (byte)14);
for (int i=1 ; i<6 ; i++) for (int i=1 ; i<6 ; i++)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0); if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
} }
_red.subtract(xRed, 0, zRed); _red.subtract(xRed, 0, zRed);
@ -199,7 +201,8 @@ public class TurfForts extends TeamGame
MapUtil.QuickChangeBlockAt(loc, 159, (byte)3); MapUtil.QuickChangeBlockAt(loc, 159, (byte)3);
for (int i=1 ; i<6 ; i++) for (int i=1 ; i<6 ; i++)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0); if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
} }
if (zRed != 0) if (zRed != 0)
@ -209,7 +212,8 @@ public class TurfForts extends TeamGame
MapUtil.QuickChangeBlockAt(loc, 159, (byte)3); MapUtil.QuickChangeBlockAt(loc, 159, (byte)3);
for (int i=1 ; i<6 ; i++) for (int i=1 ; i<6 ; i++)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0); if (loc.getBlock().getRelative(BlockFace.UP, i).getTypeId() == 35)
MapUtil.QuickChangeBlockAt(loc.clone().add(0, i, 0), 0, (byte)0);
} }
_red.add(xRed, 0, zRed); _red.add(xRed, 0, zRed);
@ -225,8 +229,8 @@ public class TurfForts extends TeamGame
{ {
if (!_fight) if (!_fight)
{ {
event.setCancelled(true);
UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot attack during Build Time!")); UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot attack during Build Time!"));
event.getProjectile().remove();
} }
} }
@ -243,13 +247,8 @@ public class TurfForts extends TeamGame
return; return;
} }
if (event.getBlock().getLocation().getY() > _turf.get(0).getBlockY() + 5)
{ //On Own
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high up."));
event.setCancelled(true);
return;
}
Block block = event.getBlock().getRelative(BlockFace.DOWN); Block block = event.getBlock().getRelative(BlockFace.DOWN);
while (block.getTypeId() == 0) while (block.getTypeId() == 0)
block = block.getRelative(BlockFace.DOWN); block = block.getRelative(BlockFace.DOWN);
@ -260,6 +259,24 @@ public class TurfForts extends TeamGame
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
//Height
boolean aboveTurf = false;
for (int i=1 ; i<=5 ; i++)
{
if (event.getBlock().getRelative(BlockFace.DOWN, i).getTypeId() != 159)
continue;
aboveTurf = true;
break;
}
if (!aboveTurf)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high above Turf."));
event.setCancelled(true);
return;
}
} }
@EventHandler @EventHandler
@ -330,9 +347,16 @@ public class TurfForts extends TeamGame
@EventHandler @EventHandler
public void Damage(CustomDamageEvent event) public void Damage(CustomDamageEvent event)
{ {
if (!_fight) if (event.GetCause() == DamageCause.FALL)
{
event.SetCancelled("No Fall");
return;
}
if (!_fight && (event.GetCause() == DamageCause.PROJECTILE || event.GetCause() == DamageCause.ENTITY_ATTACK))
{ {
event.SetCancelled("Build Time"); event.SetCancelled("Build Time");
return;
} }
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
@ -509,7 +533,7 @@ public class TurfForts extends TeamGame
for (Player player : team.GetPlayers(true)) for (Player player : team.GetPlayers(true))
{ {
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
while (block.getTypeId() == 0 && block.getY() > 0) while (block.getTypeId() != 159 && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN); block = block.getRelative(BlockFace.DOWN);
if (block.getTypeId() == 0) if (block.getTypeId() == 0)
@ -544,8 +568,6 @@ public class TurfForts extends TeamGame
{ {
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), team.GetSpawn()), 2, false, 0, 0.8, 1, true); UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), team.GetSpawn()), 2, false, 0, 0.8, 1, true);
player.damage(10);
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
UtilPlayer.message(player, F.main("Game", "You cannot walk on the enemies turf!")); UtilPlayer.message(player, F.main("Game", "You cannot walk on the enemies turf!"));
} }

View File

@ -85,7 +85,7 @@ public class UHC extends TeamGame
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
private NautHashMap<Player, Long> _combatTime = new NautHashMap<Player, Long>(); private NautHashMap<Player, Long> _combatTime = new NautHashMap<Player, Long>();
private int _gameMinutes = 0; private int _gameMinutes = 0;
@ -133,7 +133,7 @@ public class UHC extends TeamGame
this.IdleKick = false; this.IdleKick = false;
this.AutoStart = false; this.AutoStart = false;
this.SoupEnabled = false; this.SoupEnabled = false;
CraftRecipes(); CraftRecipes();
@ -212,7 +212,7 @@ public class UHC extends TeamGame
{ {
if (event.GetState() != GameState.Prepare) if (event.GetState() != GameState.Prepare)
return; return;
//Disable Damage Manager //Disable Damage Manager
Manager.GetDamage().SetEnabled(false); Manager.GetDamage().SetEnabled(false);
@ -240,7 +240,26 @@ public class UHC extends TeamGame
player.setExhaustion(0f); player.setExhaustion(0f);
} }
} }
@EventHandler
public void KillMobs(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
//Kill Mobs
for (Entity ent : WorldData.World.getEntities())
{
if (!(ent instanceof LivingEntity))
continue;
if (ent instanceof Player)
continue;
ent.remove();
}
}
@EventHandler @EventHandler
public void WorldBoundaryCheck(PlayerMoveEvent event) public void WorldBoundaryCheck(PlayerMoveEvent event)
{ {
@ -538,7 +557,7 @@ public class UHC extends TeamGame
team.RemovePlayer(player); team.RemovePlayer(player);
return; return;
} }
if (player.isDead()) if (player.isDead())
return; return;
@ -554,10 +573,10 @@ public class UHC extends TeamGame
if (!team.IsAlive(player)) if (!team.IsAlive(player))
{ {
team.SetPlayerState(player, PlayerState.OUT); team.RemovePlayer(player);
return; return;
} }
_rejoinTime.put(player.getName(), System.currentTimeMillis()); _rejoinTime.put(player.getName(), System.currentTimeMillis());
GetLocationStore().put(player.getName(), player.getLocation()); GetLocationStore().put(player.getName(), player.getLocation());
@ -572,7 +591,7 @@ public class UHC extends TeamGame
return; return;
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true); LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
//No PvP //No PvP
if (_gameMinutes < 20) if (_gameMinutes < 20)
{ {
@ -582,7 +601,7 @@ public class UHC extends TeamGame
return; return;
} }
} }
//Damager //Damager
if (damagerEnt != null) if (damagerEnt != null)
{ {
@ -608,7 +627,7 @@ public class UHC extends TeamGame
if (event.getEntity() instanceof Player) if (event.getEntity() instanceof Player)
{ {
Player damagee = (Player)event.getEntity(); Player damagee = (Player)event.getEntity();
if (!UtilTime.elapsed(GetStateTime(), 20000)) if (!UtilTime.elapsed(GetStateTime(), 20000))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -640,7 +659,7 @@ public class UHC extends TeamGame
while (rejoinIterator.hasNext()) while (rejoinIterator.hasNext())
{ {
String name = rejoinIterator.next(); String name = rejoinIterator.next();
if (!UtilTime.elapsed(_rejoinTime.get(name), 600000)) if (!UtilTime.elapsed(_rejoinTime.get(name), 600000))
continue; continue;
@ -965,14 +984,14 @@ public class UHC extends TeamGame
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler @EventHandler
public void RejoinCommand(PlayerCommandPreprocessEvent event) public void RejoinCommand(PlayerCommandPreprocessEvent event)
{ {
if (event.getMessage().startsWith("/allowrejoin")) if (event.getMessage().startsWith("/allowrejoin"))
{ {
String[] toks = event.getMessage().split(" "); String[] toks = event.getMessage().split(" ");
if (toks.length <= 1) if (toks.length <= 1)
{ {
event.getPlayer().sendMessage("Missing Param!"); event.getPlayer().sendMessage("Missing Param!");
@ -982,7 +1001,7 @@ public class UHC extends TeamGame
_rejoinTime.put(toks[1], System.currentTimeMillis()); _rejoinTime.put(toks[1], System.currentTimeMillis());
event.getPlayer().sendMessage("Allowed " + toks[1] + " to rejoin!"); event.getPlayer().sendMessage("Allowed " + toks[1] + " to rejoin!");
} }
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -992,7 +1011,7 @@ public class UHC extends TeamGame
{ {
if (event.isCancelled()) if (event.isCancelled())
return; return;
//Damager //Damager
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true); LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
if (damagerEnt != null) if (damagerEnt != null)
@ -1002,7 +1021,7 @@ public class UHC extends TeamGame
Player damager = (Player)damagerEnt; Player damager = (Player)damagerEnt;
GameTeam team = GetTeam(damager); GameTeam team = GetTeam(damager);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY) if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
{ {
event.setCancelled(true); event.setCancelled(true);
@ -1017,7 +1036,7 @@ public class UHC extends TeamGame
Player damagee = (Player)event.getEntity(); Player damagee = (Player)event.getEntity();
GameTeam team = GetTeam(damagee); GameTeam team = GetTeam(damagee);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY) if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
{ {
event.setCancelled(true); event.setCancelled(true);
@ -1109,7 +1128,7 @@ public class UHC extends TeamGame
String health = " - " + col; String health = " - " + col;
int hp = (int)(player.getHealth() + 0.9999999999); int hp = (int)(player.getHealth() + 0.9999999999);
if (hp % 2 == 0) if (hp % 2 == 0)
health += (int)(hp/2); health += (int)(hp/2);
else else
@ -1121,7 +1140,7 @@ public class UHC extends TeamGame
{ {
while (name.length() + health.length() > 16) while (name.length() + health.length() > 16)
name = name.substring(0, name.length()-1); name = name.substring(0, name.length()-1);
player.setPlayerListName(name + health); player.setPlayerListName(name + health);
} }
catch (Exception e) catch (Exception e)

View File

@ -29,6 +29,7 @@ public class PerkArrowRebound extends Perk
{ {
super("Chain Arrows", new String[] super("Chain Arrows", new String[]
{ {
C.cGray + "On hit, arrows bounce to nearby enemies.",
C.cGray + "Arrows bounce up to " + max + " times.", C.cGray + "Arrows bounce up to " + max + " times.",
}); });

View File

@ -30,7 +30,7 @@ public class PerkCowBomb extends Perk implements IThrown
{ {
super("Cow Bomb", new String[] super("Cow Bomb", new String[]
{ {
C.cYellow + "Right-Click" + C.cGray + " with Shovel to use " + C.cGreen + "Cow Bomb" C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Cow Bomb"
}); });
} }
@ -50,7 +50,7 @@ public class PerkCowBomb extends Perk implements IThrown
if (event.getPlayer().getItemInHand() == null) if (event.getPlayer().getItemInHand() == null)
return; return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();

View File

@ -115,6 +115,7 @@ public class PerkLeap extends Perk
ent = player.getVehicle(); ent = player.getVehicle();
UtilAction.velocity(ent, _power, 0.2, _heightMax, true); UtilAction.velocity(ent, _power, 0.2, _heightMax, true);
player.setFallDistance(0); player.setFallDistance(0);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + ".")); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + "."));

View File

@ -0,0 +1,140 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Cow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkSeismicCow extends Perk
{
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
public PerkSeismicCow()
{
super("Seismic Slam", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Shovel to " + C.cGreen + "Seismic Slam"
});
}
@EventHandler
public void Leap(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 6000, true))
return;
//Action
Vector vec = player.getLocation().getDirection();
if (vec.getY() < 0)
vec.setY(vec.getY() * -1);
UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true);
//Record
_live.put(player, System.currentTimeMillis());
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Slam(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!UtilEnt.isGrounded(player))
continue;
if (!_live.containsKey(player))
continue;
if (!UtilTime.elapsed(_live.get(player), 1000))
continue;
_live.remove(player);
//Action
int damage = 4;
double range = 6;
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
continue;
if (cur instanceof Cow)
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, false, true, false,
player.getName(), GetName());
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
1.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.6, true);
//Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
//Inform
if (cur instanceof Player)
UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + "."));
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
}
}
}

View File

@ -35,7 +35,7 @@ public class PerkSeismicSlam extends Perk
{ {
super("Seismic Slam", new String[] super("Seismic Slam", new String[]
{ {
C.cYellow + "Right-Click" + C.cGray + " with Shovel to " + C.cGreen + "Seismic Slam" C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Seismic Slam"
}); });
} }

View File

@ -0,0 +1,123 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkSkullShot extends Perk
{
private HashMap<Player, Long> _shootTime = new HashMap<Player, Long>();
private HashMap<WitherSkull, Vector> _skullDir = new HashMap<WitherSkull, Vector>();
public PerkSkullShot()
{
super("Skull Shot", new String[]
{
C.cYellow + "Shoot Bow" + C.cGray + " to use " + C.cGreen + "Skull Shot"
});
}
@EventHandler
public void Fire(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
Player player = (Player)event.getEntity();
if (!Kit.HasKit(player))
return;
Vector vel = event.getProjectile().getVelocity();
event.getProjectile().remove();
WitherSkull skull = player.launchProjectile(WitherSkull.class);
skull.setDirection(vel);
skull.setVelocity(vel);
_skullDir.put(skull, vel.multiply(0.5));
_shootTime.put(player, System.currentTimeMillis());
//Helmet
player.getInventory().setHelmet(null);
player.getInventory().remove(Material.ARROW);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void SkullDir(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
Iterator<WitherSkull> skullIterator = _skullDir.keySet().iterator();
while (skullIterator.hasNext())
{
WitherSkull skull = skullIterator.next();
if (!skull.isValid())
{
skullIterator.remove();
continue;
}
skull.setVelocity(_skullDir.get(skull));
skull.setDirection(_skullDir.get(skull));
}
}
@EventHandler
public void ArrowRespawn(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
Iterator<Player> playerIterator = _shootTime.keySet().iterator();
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
if (!UtilTime.elapsed(_shootTime.get(player), 2000))
continue;
playerIterator.remove();
//Helmet
ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1);
player.getInventory().setHelmet(head);
player.getInventory().addItem(new ItemStack(Material.ARROW));
}
}
@EventHandler
public void Death(PlayerDeathEvent event)
{
_shootTime.remove(event.getEntity());
}
}

View File

@ -247,7 +247,7 @@ public class PerkSlimeRocket extends Perk implements IThrown
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, slime.getSize() * 4, true, true, false, DamageCause.PROJECTILE, slime.getSize() * 5, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName()); UtilEnt.getName(data.GetThrower()), GetName());
} }
@ -257,7 +257,7 @@ public class PerkSlimeRocket extends Perk implements IThrown
if (event.GetReason() == null || !event.GetReason().contains(GetName())) if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return; return;
event.AddKnockback(GetName(), 2.5); event.AddKnockback(GetName(), 3.0);
} }
@Override @Override

View File

@ -120,10 +120,10 @@ public class GameGemManager implements Listener
//Give Gems //Give Gems
if (give) if (give)
GiveGems(player, game.GetPlayerGems().remove(player)); GiveGems(player, game.GetPlayerGems().remove(player), game.GemMultiplier);
} }
public void GiveGems(Player player, HashMap<String,GemData> gems) public void GiveGems(Player player, HashMap<String,GemData> gems, double gameMult)
{ {
if (gems == null) if (gems == null)
return; return;
@ -138,6 +138,8 @@ public class GameGemManager implements Listener
if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA")) if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA"))
total = total * 2; total = total * 2;
total = (int) (total * gameMult);
Manager.GetDonation().RewardGems(null, player.getName(), total); Manager.GetDonation().RewardGems(null, player.getName(), total);
} }
@ -164,6 +166,8 @@ public class GameGemManager implements Listener
gemCount = 1; gemCount = 1;
earnedGems += gemCount; earnedGems += gemCount;
earnedGems = (int) (earnedGems * game.GemMultiplier);
int amount = gems.get(type).Amount; int amount = gems.get(type).Amount;
String amountStr = ""; String amountStr = "";
@ -194,9 +198,4 @@ public class GameGemManager implements Listener
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);
} }
public double GetScale(Game game)
{
return 0.25 + (0.75 * ((double)game.GetPlayerCountAtStart() / (double)Manager.GetPlayerFull()));
}
} }

View File

@ -458,7 +458,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
kits.add(kit); kits.add(kit);
} }
//Radial for smash //Smash
if (game.GetType() == GameType.Smash) if (game.GetType() == GameType.Smash)
{ {
WriteKitLine("Free", 0, 159, (byte)15); WriteKitLine("Free", 0, 159, (byte)15);
@ -469,8 +469,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener
for (int i=0 ; i<kits.size() ; i++) for (int i=0 ; i<kits.size() ; i++)
{ {
if (i < kits.size()/2) kitsA.add(kits.get(i)); if (kits.get(i).GetAvailability() != KitAvailability.Blue) kitsA.add(kits.get(i));
else kitsB.add(kits.get(i)); else kitsB.add(kits.get(i));
} }
{ {

View File

@ -14,6 +14,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
public class MiscManager implements Listener public class MiscManager implements Listener
@ -68,17 +69,20 @@ public class MiscManager implements Listener
} }
@EventHandler @EventHandler
public void EnsureHubClock(UpdateEvent event) public void HubClockUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SLOW) if (event.getType() != UpdateType.SLOW)
return; return;
if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.UHC) if (Manager.GetGame() == null)
return;
if (Manager.GetGame().GetType() == GameType.UHC)
return; return;
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
if (Manager.GetGame() == null || !Manager.GetGame().IsAlive(player)) if (!Manager.GetGame().IsAlive(player))
{ {
if (!player.getInventory().contains(Material.WATCH)) if (!player.getInventory().contains(Material.WATCH))
{ {
@ -87,4 +91,28 @@ public class MiscManager implements Listener
} }
} }
} }
@EventHandler(priority = EventPriority.LOWEST)
public void HubClockInteract(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.WATCH)
return;
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
}
@EventHandler
public void HubCommand(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().startsWith("/hub") || event.getMessage().startsWith("/leave"))
{
Manager.GetPortal().SendPlayerToServer(event.getPlayer(), "Lobby");
event.setCancelled(true);
}
}
} }