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

This commit is contained in:
Jonathan Williams 2013-09-14 02:02:57 -07:00
commit c5f239baba
22 changed files with 298 additions and 51 deletions

View File

@ -56,6 +56,9 @@ public class Creature extends MiniPlugin
@EventHandler
public void Spawn(CreatureSpawnEvent event)
{
if (_disableCustom)
return;
if (event.getEntity() instanceof LivingEntity)
((LivingEntity)event.getEntity()).setCanPickupItems(false);
@ -239,6 +242,9 @@ public class Creature extends MiniPlugin
@EventHandler
public void CustomCreeperExplode(EntityExplodeEvent event)
{
if (_disableCustom)
return;
if (!(event.getEntity() instanceof Creeper))
return;

View File

@ -116,6 +116,21 @@ public class PartyTutorial extends Tutorial
C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "YourName " + ChatColor.RESET + C.cPurple + "Hey guys, how are you?"
}
));
_phases.add(new TutorialPhase(
manager.GetSpawn(),
manager.GetSpawn().add(0, y+0.5, 10),
"End",
new String[]
{
"",
"",
"Thanks for doing the tutorial!",
"",
"",
}
));
}
}

View File

@ -636,6 +636,15 @@ public abstract class Game implements Listener
return players;
}
public GameTeam GetTeam(String player, boolean aliveOnly)
{
for (GameTeam team : _teamList)
if (team.HasPlayer(player, aliveOnly))
return team;
return null;
}
public GameTeam GetTeam(Player player)
{
for (GameTeam team : _teamList)
@ -929,6 +938,8 @@ public abstract class Game implements Listener
UtilPlayer.message(player, message);
}
System.out.println("[Announcement] " + message);
}
public boolean AdvertiseText(GameLobbyManager gameLobbyManager, int _advertiseStage)

View File

@ -144,6 +144,15 @@ public class GameTeam
_players.remove(player);
}
public Player GetPlayer(String name)
{
for (Player player : _players.keySet())
if (player.getName().equals(name))
return player;
return null;
}
public boolean HasPlayer(Player player)
{
return _players.containsKey(player);
@ -166,6 +175,9 @@ public class GameTeam
public void SetPlayerState(Player player, PlayerState state)
{
if (player == null)
return;
_players.put(player, state);
}

View File

@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import mineplex.core.common.util.UtilServer;
@ -169,8 +170,25 @@ public class Barbarians extends SoloGame
}
@EventHandler
public void BlockBreak(BlockDamageEvent event)
public void BlockDamage(BlockDamageEvent event)
{
event.setInstaBreak(true);
}
@EventHandler
public void ItemSpawn(ItemSpawnEvent event)
{
event.setCancelled(true);
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
if (GetTeam(killed).equals(_barbs))
{
return 4;
}
return 0;
}
}

View File

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

View File

@ -306,4 +306,15 @@ public class DeathTag extends SoloGame
return true;
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
if (GetTeam(killed).equals(_runners))
{
return 4;
}
return 0;
}
}

View File

@ -47,7 +47,5 @@ public class KitAlphaChaser extends SmashKit
disguise.hideArmor();
disguise.SetSkeletonType(SkeletonType.WITHER);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -137,7 +137,7 @@ public class Dragons extends SoloGame
}
}
if (_dragons.size() < 4)
if (_dragons.size() < 7)
{
if (_dragons.size() == 0)
{

View File

@ -27,7 +27,6 @@ public class KitCoward extends Kit
new Perk[]
{
new PerkLeap("Leap", 1.2, 1.0, 8000),
new PerkKnockback(0.3)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));

View File

@ -12,7 +12,6 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockback;
public class KitMarksman extends Kit
{
@ -26,7 +25,6 @@ public class KitMarksman extends Kit
new Perk[]
{
new PerkFletcher(4, 4, true),
new PerkKnockback(0.3),
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW));

View File

@ -27,7 +27,6 @@ public class KitPyrotechnic extends Kit
new Perk[]
{
new PerkSparkler(20, 2),
new PerkKnockback(0.3)
},
EntityType.ZOMBIE,
new ItemStack(Material.EMERALD));

View File

@ -17,6 +17,7 @@ import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
@ -25,6 +26,7 @@ import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -313,12 +315,17 @@ public class MilkCow extends SoloGame
@EventHandler
public void DrinkMilk(PlayerItemConsumeEvent event)
{
if (!IsLive())
return;
if (event.getItem().getType() != Material.MILK_BUCKET)
return;
SetScore(event.getPlayer(), GetScore(event.getPlayer())+1);
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.BURP, 2f, 1f);
UtilPlayer.health(event.getPlayer(), 8);
UtilPlayer.health(event.getPlayer(), 2);
this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true);
}
public void SetScore(Player player, double level)
@ -479,4 +486,18 @@ public class MilkCow extends SoloGame
return true;
}
@EventHandler
public void BucketFill(PlayerBucketFillEvent event)
{
if (event.getBlockClicked() == null)
return;
if (event.getBlockClicked().getTypeId() != 8 && event.getBlockClicked().getTypeId() != 9)
return;
event.setCancelled(true);
UtilInv.Update(event.getPlayer());
event.getPlayer().sendBlockChange(event.getBlockClicked().getLocation(), 8, (byte)0);
}
}

View File

@ -44,7 +44,6 @@ public class KitFarmerJump extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
}
}

View File

@ -299,4 +299,10 @@ public class SuperSmash extends SoloGame
event.setCancelled(true);
}
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
return 4;
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.smash.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
public class KitComingSoon extends SmashKit
{
public KitComingSoon(ArcadeManager manager)
{
super(manager, C.cRed + "Coming Soon", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
},
EntityType.VILLAGER,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -132,8 +132,6 @@ public class Spleef extends SoloGame
public void BlockFade(Block block, Player player)
{
this.AddGems(player, 0.015, "Spleef Blocks Broken", true);
UtilPlayer.hunger(player, 1);
//Wool and Stained Clay
@ -200,9 +198,9 @@ public class Spleef extends SoloGame
}
@EventHandler
public void DamageUpdate(UpdateEvent event)
public void Hunger(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.SEC)
return;
if (!IsLive())

View File

@ -83,7 +83,7 @@ public class UHC extends TeamGame
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
private NautHashMap<Player, Long> _rejoinTime = new NautHashMap<Player, Long>();
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
private NautHashMap<Player, Long> _combatTime = new NautHashMap<Player, Long>();
@ -132,6 +132,8 @@ public class UHC extends TeamGame
this.IdleKick = false;
this.AutoStart = false;
this.SoupEnabled = false;
CraftRecipes();
@ -195,8 +197,6 @@ public class UHC extends TeamGame
else if (_gameMinutes == 20)
{
Announce(ChatColor.WHITE + C.Bold + "PvP enabled! 20 minutes have passed.");
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 1f);
this.DamagePvP = true;
}
@ -514,11 +514,10 @@ public class UHC extends TeamGame
continue;
player.kickPlayer(C.cYellow + "60 Seconds have passed since you died.\nYou have been removed.");
_deathTime.remove(player.getName());
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerKick(PlayerKickEvent event)
{
@ -530,9 +529,6 @@ public class UHC extends TeamGame
{
Player player = event.getPlayer();
if (player.isDead())
return;
GameTeam team = GetTeam(player);
if (team == null) return;
@ -541,6 +537,9 @@ public class UHC extends TeamGame
team.RemovePlayer(player);
return;
}
if (player.isDead())
return;
if (_combatTime.containsKey(player) && !UtilTime.elapsed(_combatTime.get(player), 15000))
{
@ -548,14 +547,17 @@ public class UHC extends TeamGame
Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat.");
player.damage(5000);
//team.SetPlayerState(player, PlayerState.OUT);
team.SetPlayerState(player, PlayerState.OUT);
return;
}
if (!team.IsAlive(player))
{
team.SetPlayerState(player, PlayerState.OUT);
return;
_rejoinTime.put(player, System.currentTimeMillis());
}
_rejoinTime.put(player.getName(), System.currentTimeMillis());
GetLocationStore().put(player.getName(), player.getLocation());
//Announcement
@ -605,6 +607,12 @@ public class UHC extends TeamGame
if (event.getEntity() instanceof Player)
{
Player damagee = (Player)event.getEntity();
if (!UtilTime.elapsed(GetStateTime(), 20000))
{
event.setCancelled(true);
return;
}
//Damagee Not Alive
if (!IsAlive(damagee))
@ -626,23 +634,23 @@ public class UHC extends TeamGame
if (event.getType() != UpdateType.SEC)
return;
Iterator<Player> rejoinIterator = _rejoinTime.keySet().iterator();
Iterator<String> rejoinIterator = _rejoinTime.keySet().iterator();
while (rejoinIterator.hasNext())
{
Player oldPlayer = rejoinIterator.next();
if (!UtilTime.elapsed(_rejoinTime.get(oldPlayer), 600000))
String name = rejoinIterator.next();
if (!UtilTime.elapsed(_rejoinTime.get(name), 600000))
continue;
rejoinIterator.remove();
//Get Team (By Name)
GameTeam team = GetTeam(oldPlayer);
GameTeam team = GetTeam(name, false);
if (team != null)
{
Announce(team.GetColor() + C.Bold + oldPlayer.getName() + " did not reconnent in time!");
team.SetPlayerState(oldPlayer, PlayerState.OUT);
Announce(team.GetColor() + C.Bold + name + " did not reconnent in time!");
team.SetPlayerState(team.GetPlayer(name), PlayerState.OUT);
}
}
}
@ -676,7 +684,7 @@ public class UHC extends TeamGame
{
team.ReplaceReference(event.getPlayer());
if (_rejoinTime.remove(oldPlayer) != null)
if (_rejoinTime.remove(oldPlayer.getName()) != null)
{
//Announcement
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!");
@ -956,6 +964,27 @@ public class UHC extends TeamGame
event.setCancelled(true);
}
}
@EventHandler
public void RejoinCommand(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().startsWith("/allowrejoin"))
{
String[] toks = event.getMessage().split(" ");
if (toks.length <= 1)
{
event.getPlayer().sendMessage("Missing Param!");
}
else
{
_rejoinTime.put(toks[1], System.currentTimeMillis());
event.getPlayer().sendMessage("Allowed " + toks[1] + " to rejoin!");
}
event.setCancelled(true);
}
}
@EventHandler
public void SpecialDamage(EntityDamageEvent event)
@ -1066,10 +1095,12 @@ public class UHC extends TeamGame
String health = " - " + col;
if (((int)player.getHealth()) % 2 == 0)
health += (int)(player.getHealth()/2);
int hp = (int)(player.getHealth() + 0.9999999999);
if (hp % 2 == 0)
health += (int)(hp/2);
else
health += UtilMath.trim(1, player.getHealth()/2d);
health += UtilMath.trim(1, hp/2d);
String name = team.GetColor() + player.getName();
@ -1119,7 +1150,6 @@ public class UHC extends TeamGame
*/
}
@Override
public boolean CanJoinTeam(GameTeam team)
{

View File

@ -82,7 +82,7 @@ public class PerkCreeperElectricity extends Perk
continue;
}
if (UtilTime.elapsed(_active.get(player), 3000))
if (UtilTime.elapsed(_active.get(player), 2000))
{
shieldIterator.remove();

View File

@ -109,7 +109,7 @@ public class PerkFirefly extends Perk
}
//Velocity
else if (!UtilTime.elapsed(data.Time, 2000))
else if (!UtilTime.elapsed(data.Time, 2500))
{
data.Player.setVelocity(data.Player.getLocation().getDirection().multiply(0.7).add(new Vector(0,0.1,0)));
//data.Player.setVelocity(data.Location.getDirection().multiply(0.7).add(new Vector(0,0.1,0)));

View File

@ -23,7 +23,6 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -34,7 +33,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
@ -221,21 +219,24 @@ public class GameFlagManager implements Listener
}
@EventHandler(priority = EventPriority.LOWEST)
public void ItemDropEvent(InventoryOpenEvent event)
public void InventoryOpen(PlayerInteractEvent event)
{
HumanEntity player = event.getPlayer();
Game game = Manager.GetGame();
if (game == null)
return;
if (!game.InProgress())
return;
if (game.InventoryOpen)
return;
player.closeInventory();
if (event.getClickedBlock() == null)
return;
if (!UtilBlock.usable(event.getClickedBlock()))
return;
event.setCancelled(true);
}

View File

@ -299,6 +299,14 @@ public class GameLobbyManager implements IPacketRunnable, Listener
block.setType(_teamBlocks.get(block));
_teamBlocks.clear();
//Smash
if (game.GetType() == GameType.Smash)
{
//Text
WriteTeamLine("Ultra", 0, 159, (byte)15);
WriteTeamLine("Kits", 1, 159, (byte)4);
return;
}
//Standard
if (game.GetKits().length > 1 || game.GetType() != GameType.UHC)
@ -449,6 +457,87 @@ public class GameLobbyManager implements IPacketRunnable, Listener
if (kit.GetAvailability() != KitAvailability.Hide)
kits.add(kit);
}
//Radial for smash
if (game.GetType() == GameType.Smash)
{
WriteKitLine("Free", 0, 159, (byte)15);
WriteKitLine("Kits", 1, 159, (byte)4);
ArrayList<Kit> kitsA = new ArrayList<Kit>();
ArrayList<Kit> kitsB = new ArrayList<Kit>();
for (int i=0 ; i<kits.size() ; i++)
{
if (i < kits.size()/2) kitsA.add(kits.get(i));
else kitsB.add(kits.get(i));
}
{
//Positions
double space = 4;
double offset = (kitsA.size()-1)*space/2d;
for (int i=0 ; i<kitsA.size() ; i++)
{
Kit kit = kitsA.get(i);
if (kit.GetAvailability() == KitAvailability.Null)
continue;
Location entLoc = _kitDisplay.clone().subtract(0, 0, i*space - offset);
byte data = 4;
if (kit.GetAvailability() == KitAvailability.Green) data = 5;
else if (kit.GetAvailability() == KitAvailability.Blue) data = 3;
SetKitTeamBlocks(entLoc.clone(), 35, data, _kitBlocks);
entLoc.add(0, 1.5, 0);
entLoc.getChunk().load();
Entity ent = kit.SpawnEntity(entLoc);
if (ent == null)
continue;
_kits.put(ent, new LobbyEnt(ent, entLoc, kit));
}
}
{
//Positions
double space = 4;
double offset = (kitsB.size()-1)*space/2d;
for (int i=0 ; i<kitsB.size() ; i++)
{
Kit kit = kitsB.get(i);
if (kit.GetAvailability() == KitAvailability.Null)
continue;
Location entLoc = _teamDisplay.clone().subtract(0, 0, i*space - offset);
byte data = 4;
if (kit.GetAvailability() == KitAvailability.Green) data = 5;
else if (kit.GetAvailability() == KitAvailability.Blue) data = 3;
SetKitTeamBlocks(entLoc.clone(), 35, data, _kitBlocks);
entLoc.add(0, 1.5, 0);
entLoc.getChunk().load();
Entity ent = kit.SpawnEntity(entLoc);
if (ent == null)
continue;
_kits.put(ent, new LobbyEnt(ent, entLoc, kit));
}
}
return;
}
//Positions
double space = 4;
@ -522,7 +611,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
for (int z=-2 ; z<2 ; z++)
{
block = loc.clone().add(x, -1, z).getBlock();
block = loc.clone().add(x + 0.5, -1, z + 0.5).getBlock();
blockMap.put(block, block.getType());
MapUtil.QuickChangeBlockAt(block.getLocation(), id, data);
@ -534,7 +623,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
for (int z=-3 ; z<3 ; z++)
{
block = loc.clone().add(x, -1, z).getBlock();
block = loc.clone().add(x + 0.5, -1, z + 0.5).getBlock();
if (blockMap.containsKey(block))
continue;