nerfed farmer in milk teh cow

fixed some UHC bugs
made party tutorial return you to spawn
This commit is contained in:
Chiss 2013-09-14 15:20:28 +10:00
parent 34c333dac9
commit 72718ff7b4
5 changed files with 80 additions and 21 deletions

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)

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

@ -323,7 +323,7 @@ public class MilkCow extends SoloGame
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);
}

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>();
@ -197,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;
}
@ -236,7 +234,6 @@ public class UHC extends TeamGame
{
Manager.GetCondition().Factory().Blind("Start Blind", player, player, 8, 1, false, false, false);
Manager.GetCondition().Factory().Slow("Start Slow", player, player, 8, 4, false, false, false, false);
Manager.GetCondition().Factory().Invulnerable("Start Invul", player, player, 24, false, false);
player.setSaturation(3f);
player.setExhaustion(0f);
@ -517,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)
{
@ -533,9 +529,6 @@ public class UHC extends TeamGame
{
Player player = event.getPlayer();
if (player.isDead())
return;
GameTeam team = GetTeam(player);
if (team == null) return;
@ -544,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))
{
@ -551,17 +547,17 @@ public class UHC extends TeamGame
Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat.");
player.damage(5000);
team.RemovePlayer(player);
team.SetPlayerState(player, PlayerState.OUT);
return;
}
if (!team.IsAlive(player))
{
team.RemovePlayer(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
@ -611,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))
@ -632,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);
}
}
}
@ -682,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!");
@ -962,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)