UHC prep for s4
Draw updates
This commit is contained in:
parent
fee559a892
commit
c8fc792fdd
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.draw;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -57,6 +58,8 @@ public class Draw extends SoloGame
|
|||||||
private byte _brushColor = 15;
|
private byte _brushColor = 15;
|
||||||
private Location _brushPrevious = null;
|
private Location _brushPrevious = null;
|
||||||
|
|
||||||
|
private boolean _lockDrawer = true;
|
||||||
|
|
||||||
//Round
|
//Round
|
||||||
private int _roundCount = 0;
|
private int _roundCount = 0;
|
||||||
private int _roundMax = 0;
|
private int _roundMax = 0;
|
||||||
@ -71,6 +74,7 @@ public class Draw extends SoloGame
|
|||||||
private Collection<Block> _textBlocks = null;
|
private Collection<Block> _textBlocks = null;
|
||||||
|
|
||||||
private String[] _words;
|
private String[] _words;
|
||||||
|
private HashSet<String> _usedWords = new HashSet<String>();
|
||||||
|
|
||||||
public Draw(ArcadeManager manager)
|
public Draw(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
@ -198,7 +202,7 @@ public class Draw extends SoloGame
|
|||||||
if (_round != null && (_round.IsDone() || _drawers.GetPlayers(true).isEmpty() || _round.AllGuessed(_guessers.GetPlayers(true))))
|
if (_round != null && (_round.IsDone() || _drawers.GetPlayers(true).isEmpty() || _round.AllGuessed(_guessers.GetPlayers(true))))
|
||||||
{
|
{
|
||||||
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + " Ended: " + C.cYellow + C.Bold + "The word was " + _round.Word + "!");
|
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + " Ended: " + C.cYellow + C.Bold + "The word was " + _round.Word + "!");
|
||||||
_textBlocks = UtilText.MakeText(_round.Word, _textLocation, BlockFace.NORTH, 159, (byte)15, TextAlign.CENTER);
|
_textBlocks = UtilText.MakeText(_round.Word, _textLocation, BlockFace.WEST, 159, (byte)15, TextAlign.CENTER);
|
||||||
|
|
||||||
_roundTime = System.currentTimeMillis();
|
_roundTime = System.currentTimeMillis();
|
||||||
_round = null;
|
_round = null;
|
||||||
@ -212,6 +216,7 @@ public class Draw extends SoloGame
|
|||||||
|
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
|
player.setFlySpeed(0.1f);
|
||||||
|
|
||||||
player.teleport(_guessers.GetSpawn());
|
player.teleport(_guessers.GetSpawn());
|
||||||
}
|
}
|
||||||
@ -230,16 +235,23 @@ public class Draw extends SoloGame
|
|||||||
_guessers.RemovePlayer(drawer);
|
_guessers.RemovePlayer(drawer);
|
||||||
_drawers.AddPlayer(drawer);
|
_drawers.AddPlayer(drawer);
|
||||||
|
|
||||||
|
//Get Word
|
||||||
|
String word = _words[UtilMath.r(_words.length)];
|
||||||
|
while (!_usedWords.add(word))
|
||||||
|
word = _words[UtilMath.r(_words.length)];
|
||||||
|
|
||||||
//Create Round
|
//Create Round
|
||||||
_round = new DrawRound(this, drawer, _words[UtilMath.r(_words.length)]);
|
_round = new DrawRound(this, drawer, word);
|
||||||
|
|
||||||
//Prep Drawer
|
//Prep Drawer
|
||||||
drawer.teleport(_drawerLocation);
|
drawer.teleport(_drawerLocation);
|
||||||
|
|
||||||
drawer.setAllowFlight(true);
|
drawer.setAllowFlight(true);
|
||||||
drawer.setFlying(true);
|
drawer.setFlying(true);
|
||||||
|
drawer.setFlySpeed(0.4f);
|
||||||
|
|
||||||
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Paint Brush"));
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Thin Paint Brush"));
|
||||||
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Thick Paint Brush"));
|
||||||
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket"));
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket"));
|
||||||
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas"));
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas"));
|
||||||
|
|
||||||
@ -328,6 +340,9 @@ public class Draw extends SoloGame
|
|||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!_lockDrawer)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_drawers.HasPlayer(event.getPlayer()))
|
if (!_drawers.HasPlayer(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -372,6 +387,18 @@ public class Draw extends SoloGame
|
|||||||
//Color
|
//Color
|
||||||
block.setData(_brushColor);
|
block.setData(_brushColor);
|
||||||
|
|
||||||
|
//Thick Brush
|
||||||
|
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
|
||||||
|
{
|
||||||
|
for (Block other : UtilBlock.getSurrounding(block, false))
|
||||||
|
{
|
||||||
|
if (!_canvas.contains(other))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
other.setData(_brushColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Join Dots
|
//Join Dots
|
||||||
if (_brushPrevious != null)
|
if (_brushPrevious != null)
|
||||||
{
|
{
|
||||||
@ -385,16 +412,31 @@ public class Draw extends SoloGame
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
fixBlock.setData(_brushColor);
|
fixBlock.setData(_brushColor);
|
||||||
|
|
||||||
|
//Thick Brush
|
||||||
|
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
|
||||||
|
{
|
||||||
|
for (Block other : UtilBlock.getSurrounding(fixBlock, false))
|
||||||
|
{
|
||||||
|
if (!_canvas.contains(other))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
other.setData(_brushColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
|
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
|
||||||
|
|
||||||
|
_lockDrawer = false;
|
||||||
|
|
||||||
_brushPrevious = block.getLocation().add(0.5, 0.5, 0.5);
|
_brushPrevious = block.getLocation().add(0.5, 0.5, 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PaintReset(PlayerInteractEvent event)
|
public void PaintReset(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
@ -416,7 +458,9 @@ public class Draw extends SoloGame
|
|||||||
|
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
|
//Restore
|
||||||
_brushColor = color;
|
_brushColor = color;
|
||||||
|
_lockDrawer = false;
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
other.playSound(other.getLocation(), Sound.EXPLODE, 0.5f, 1.5f);
|
other.playSound(other.getLocation(), Sound.EXPLODE, 0.5f, 1.5f);
|
||||||
@ -506,6 +550,8 @@ public class Draw extends SoloGame
|
|||||||
_textBlocks.clear();
|
_textBlocks.clear();
|
||||||
_textBlocks = null;
|
_textBlocks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lockDrawer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddScore(Player player, double amount)
|
public void AddScore(Player player, double amount)
|
||||||
|
@ -261,7 +261,7 @@ public class HideSeek extends TeamGame
|
|||||||
player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW));
|
player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW));
|
||||||
|
|
||||||
//Meower
|
//Meower
|
||||||
player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte)0, 1, C.cYellow + C.Bold + "Meow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+0.5 Gems"));
|
player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte)0, 1, C.cYellow + C.Bold + "Meow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+0.25 Gems"));
|
||||||
|
|
||||||
//Firework
|
//Firework
|
||||||
ItemStack firework = ItemStackFactory.Instance.CreateStack(Material.FIREWORK, (byte)0, 5, C.cYellow + C.Bold + "Firework" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+2 Gems");
|
ItemStack firework = ItemStackFactory.Instance.CreateStack(Material.FIREWORK, (byte)0, 5, C.cYellow + C.Bold + "Firework" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+2 Gems");
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package nautilus.game.arcade.game.games.uhc;
|
package nautilus.game.arcade.game.games.uhc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Difficulty;
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -15,7 +18,9 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.CaveSpider;
|
import org.bukkit.entity.CaveSpider;
|
||||||
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Ghast;
|
import org.bukkit.entity.Ghast;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
@ -25,6 +30,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
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.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
@ -82,9 +88,6 @@ import nautilus.game.arcade.managers.GameLobbyManager;
|
|||||||
|
|
||||||
public class UHC extends TeamGame
|
public class UHC extends TeamGame
|
||||||
{
|
{
|
||||||
//private Objective _listHealth;
|
|
||||||
private Map _map;
|
|
||||||
|
|
||||||
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>();
|
||||||
@ -96,6 +99,13 @@ public class UHC extends TeamGame
|
|||||||
private long _lastMinute = System.currentTimeMillis();
|
private long _lastMinute = System.currentTimeMillis();
|
||||||
|
|
||||||
private boolean _soloGame = false;
|
private boolean _soloGame = false;
|
||||||
|
private boolean _timerStarted = false;
|
||||||
|
private boolean _ended = false;
|
||||||
|
|
||||||
|
private ArrayList<Location> _portalBlock = null;
|
||||||
|
private ArrayList<Location> _portal = null;
|
||||||
|
private boolean _portalCreated = false;
|
||||||
|
private GameTeam _lastDragonDamager = null;
|
||||||
|
|
||||||
public UHC(ArcadeManager manager)
|
public UHC(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
@ -140,18 +150,12 @@ public class UHC extends TeamGame
|
|||||||
|
|
||||||
this.SoupEnabled = false;
|
this.SoupEnabled = false;
|
||||||
|
|
||||||
this.IdleKick = true;
|
this.IdleKick = false;
|
||||||
this.AutoStart = true;
|
this.AutoStart = false;
|
||||||
this.CompassEnabled = true;
|
this.CompassEnabled = false;
|
||||||
|
|
||||||
CraftRecipes();
|
CraftRecipes();
|
||||||
|
|
||||||
///_listHealth = this.GetScoreboard().registerNewObjective("Health", "health");
|
|
||||||
//_listHealth.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
|
||||||
|
|
||||||
_map = new Map(manager.GetPlugin());
|
|
||||||
_map.SetDefaultUrl("http://chivebox.com/img/mc/uhc.png");
|
|
||||||
|
|
||||||
//Disable Custom Mob Drops (and EXP Disable)
|
//Disable Custom Mob Drops (and EXP Disable)
|
||||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||||
|
|
||||||
@ -159,10 +163,28 @@ public class UHC extends TeamGame
|
|||||||
Manager.GetAntiStack().SetEnabled(false);
|
Manager.GetAntiStack().SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ParseData()
|
||||||
|
{
|
||||||
|
_portalBlock = WorldData.GetDataLocs("YELLOW");
|
||||||
|
_portal = WorldData.GetDataLocs("BLACK");
|
||||||
|
|
||||||
|
//Set Portal Blocks
|
||||||
|
for (int i=0 ; i<_portalBlock.size() ; i++)
|
||||||
|
{
|
||||||
|
if (i<6)
|
||||||
|
_portalBlock.get(i).getBlock().setTypeIdAndData(Material.ENDER_PORTAL_FRAME.getId(), (byte)4, true);
|
||||||
|
else
|
||||||
|
_portalBlock.get(i).getBlock().setTypeIdAndData(Material.ENDER_PORTAL_FRAME.getId(), (byte)0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TimeUpdate(UpdateEvent event)
|
public void TimeUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
if (!_timerStarted)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -578,8 +600,6 @@ public class UHC extends TeamGame
|
|||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GameTeam team = GetTeam(player);
|
GameTeam team = GetTeam(player);
|
||||||
if (team == null) return;
|
if (team == null) return;
|
||||||
|
|
||||||
@ -593,7 +613,7 @@ public class UHC extends TeamGame
|
|||||||
|
|
||||||
if (player.isDead())
|
if (player.isDead())
|
||||||
return;
|
return;
|
||||||
|
/* XXX
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
//Announcement
|
//Announcement
|
||||||
@ -602,6 +622,7 @@ public class UHC extends TeamGame
|
|||||||
player.damage(5000);
|
player.damage(5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
|
if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
|
||||||
{
|
{
|
||||||
@ -618,7 +639,7 @@ public class UHC extends TeamGame
|
|||||||
GetLocationStore().put(player.getName(), player.getLocation());
|
GetLocationStore().put(player.getName(), player.getLocation());
|
||||||
|
|
||||||
//Announcement
|
//Announcement
|
||||||
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! 10 minutes to reconnect.");
|
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! 30 minutes to reconnect.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -685,6 +706,42 @@ public class UHC extends TeamGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void CreatureCull(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!InProgress())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
HashMap<EntityType, ArrayList<Entity>> ents = new HashMap<EntityType, ArrayList<Entity>>();
|
||||||
|
|
||||||
|
for (Entity ent : WorldData.World.getEntities())
|
||||||
|
{
|
||||||
|
if (!ents.containsKey(ent.getType()))
|
||||||
|
ents.put(ent.getType(), new ArrayList<Entity>());
|
||||||
|
|
||||||
|
ents.get(ent.getType()).add(ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (EntityType type : ents.keySet())
|
||||||
|
{
|
||||||
|
ArrayList<Entity> entList = ents.get(type);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while (entList.size() > 300)
|
||||||
|
{
|
||||||
|
Entity ent = entList.remove(UtilMath.r(entList.size()));
|
||||||
|
ent.remove();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
System.out.println("Removed " + count + " " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerRejoinExpire(UpdateEvent event)
|
public void PlayerRejoinExpire(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -697,7 +754,7 @@ public class UHC extends TeamGame
|
|||||||
{
|
{
|
||||||
String name = rejoinIterator.next();
|
String name = rejoinIterator.next();
|
||||||
|
|
||||||
if (!UtilTime.elapsed(_rejoinTime.get(name), 600000))
|
if (!UtilTime.elapsed(_rejoinTime.get(name), 1800000))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rejoinIterator.remove();
|
rejoinIterator.remove();
|
||||||
@ -705,7 +762,7 @@ public class UHC extends TeamGame
|
|||||||
//Get Team (By Name)
|
//Get Team (By Name)
|
||||||
GameTeam team = _rejoinTeam.remove(name);
|
GameTeam team = _rejoinTeam.remove(name);
|
||||||
if (team != null)
|
if (team != null)
|
||||||
Announce(team.GetColor() + C.Bold + name + " did not reconnent in time!");
|
Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,6 +943,14 @@ public class UHC extends TeamGame
|
|||||||
if (event.getMessage().startsWith("/kill"))
|
if (event.getMessage().startsWith("/kill"))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (event.getMessage().startsWith("/uhc timer start"))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
_timerStarted = true;
|
||||||
|
|
||||||
|
Announce(event.getPlayer().getName() + " started the 20 minute timer!");
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getMessage().startsWith("/uhc game start"))
|
if (event.getMessage().startsWith("/uhc game start"))
|
||||||
{
|
{
|
||||||
this.SetCountdownForce(true);
|
this.SetCountdownForce(true);
|
||||||
@ -926,8 +991,6 @@ public class UHC extends TeamGame
|
|||||||
|
|
||||||
Announce(event.getPlayer().getName() + " set time to Day and Night!");
|
Announce(event.getPlayer().getName() + " set time to Day and Night!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -1027,6 +1090,18 @@ public class UHC extends TeamGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void clearCreeperExplode(EntityExplodeEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void clearCreeperExplodeReenable(EntityExplodeEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SpecialDamage(EntityDamageEvent event)
|
public void SpecialDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -1066,38 +1141,6 @@ public class UHC extends TeamGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void SpiderPoison(EntityDamageEvent event)
|
|
||||||
{
|
|
||||||
if (event.isCancelled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof LivingEntity))
|
|
||||||
return;
|
|
||||||
|
|
||||||
//Damager
|
|
||||||
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
|
|
||||||
if (damagerEnt != null)
|
|
||||||
{
|
|
||||||
if (damagerEnt instanceof CaveSpider)
|
|
||||||
{
|
|
||||||
Manager.GetCondition().Factory().Poison("Cave Spider", (LivingEntity)event.getEntity(), damagerEnt, 7, 0, false, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void clearCreeperExplode(EntityExplodeEvent event)
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
|
||||||
public void clearCreeperExplodeReenable(EntityExplodeEvent event)
|
|
||||||
{
|
|
||||||
event.setCancelled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SpecialCloak(UpdateEvent event)
|
public void SpecialCloak(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -1116,30 +1159,6 @@ public class UHC extends TeamGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hungerHurt = false;
|
|
||||||
@EventHandler
|
|
||||||
public void HungerHurt(UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (event.getType() != UpdateType.SEC)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!InProgress())
|
|
||||||
return;
|
|
||||||
|
|
||||||
hungerHurt = !hungerHurt;
|
|
||||||
|
|
||||||
if (!hungerHurt)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
|
||||||
{
|
|
||||||
if (player.getHealth() <= 10 && player.getFoodLevel() == 0)
|
|
||||||
{
|
|
||||||
player.damage(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TabHealth(UpdateEvent event)
|
public void TabHealth(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -1209,7 +1228,7 @@ public class UHC extends TeamGame
|
|||||||
if (_soloGame)
|
if (_soloGame)
|
||||||
return (team.GetPlayers(true).isEmpty());
|
return (team.GetPlayers(true).isEmpty());
|
||||||
|
|
||||||
return (team.GetPlayers(true).size() < 3);
|
return (team.GetPlayers(true).size() < 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1299,24 +1318,36 @@ public class UHC extends TeamGame
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Announce(String message)
|
||||||
|
{
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("[Announcement] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_ended)
|
||||||
|
return;
|
||||||
|
|
||||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||||
|
|
||||||
//Online Teams
|
//Online Teams
|
||||||
for (GameTeam team : this.GetTeamList())
|
for (GameTeam team : this.GetTeamList())
|
||||||
if (team.GetColor() != ChatColor.DARK_GRAY)
|
if (team.GetPlayers(true).size() > 0)
|
||||||
if (team.GetPlayers(true).size() > 0)
|
teamsAlive.add(team);
|
||||||
teamsAlive.add(team);
|
|
||||||
|
|
||||||
//Offline Player Team
|
//Offline Player Team
|
||||||
for (GameTeam team : _rejoinTeam.values())
|
for (GameTeam team : _rejoinTeam.values())
|
||||||
if (team.GetColor() != ChatColor.DARK_GRAY)
|
teamsAlive.add(team);
|
||||||
teamsAlive.add(team);
|
|
||||||
|
|
||||||
if (teamsAlive.size() <= 1)
|
if (teamsAlive.size() <= 1)
|
||||||
{
|
{
|
||||||
@ -1324,21 +1355,107 @@ public class UHC extends TeamGame
|
|||||||
if (teamsAlive.size() > 0)
|
if (teamsAlive.size() > 0)
|
||||||
AnnounceEnd(teamsAlive.get(0));
|
AnnounceEnd(teamsAlive.get(0));
|
||||||
|
|
||||||
for (GameTeam team : GetTeamList())
|
|
||||||
{
|
|
||||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
|
||||||
{
|
|
||||||
for (Player player : team.GetPlayers(false))
|
|
||||||
AddGems(player, 10, "Winning Team", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : team.GetPlayers(false))
|
|
||||||
if (player.isOnline())
|
|
||||||
AddGems(player, 10, "Participation", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//End
|
//End
|
||||||
SetState(GameState.End);
|
_ended = true;
|
||||||
|
//SetState(GameState.End);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DragonDamage(EntityDamageEvent event)
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_ended)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(event.getEntity() instanceof EnderDragon))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Damager
|
||||||
|
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
|
||||||
|
if (damagerEnt != null)
|
||||||
|
{
|
||||||
|
if (damagerEnt instanceof Player)
|
||||||
|
{
|
||||||
|
Player damager = (Player)damagerEnt;
|
||||||
|
|
||||||
|
GameTeam team = GetTeam(damager);
|
||||||
|
|
||||||
|
if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
|
||||||
|
{
|
||||||
|
if (_lastDragonDamager == null || !_lastDragonDamager.equals(team))
|
||||||
|
{
|
||||||
|
_lastDragonDamager = team;
|
||||||
|
Announce(team.GetColor() + C.Bold + team.GetName() + " are attacking the Ender Dragon!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DragonDeath(EntityDeathEvent event)
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_ended)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_lastDragonDamager == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AnnounceEnd(_lastDragonDamager);
|
||||||
|
_ended = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void PortalCreate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!InProgress())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
boolean complete = true;
|
||||||
|
for (Location loc : _portalBlock)
|
||||||
|
{
|
||||||
|
if (loc.getBlock().getType() != Material.ENDER_PORTAL_FRAME)
|
||||||
|
loc.getBlock().setType(Material.ENDER_PORTAL_FRAME);
|
||||||
|
|
||||||
|
if (loc.getBlock().getData() < 4)
|
||||||
|
complete = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (complete)
|
||||||
|
{
|
||||||
|
if (!_portalCreated)
|
||||||
|
{
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 1f);
|
||||||
|
|
||||||
|
Announce(ChatColor.WHITE + C.Bold + "The portal to The End has been opened!");
|
||||||
|
}
|
||||||
|
|
||||||
|
_portalCreated = true;
|
||||||
|
|
||||||
|
for (Location loc : _portal)
|
||||||
|
loc.getBlock().setTypeIdAndData(Material.ENDER_PORTAL.getId(), (byte)0, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (Location loc : _portal)
|
||||||
|
loc.getBlock().setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void PortalBreak(BlockBreakEvent event)
|
||||||
|
{
|
||||||
|
if (event.getBlock().getType() == Material.ENDER_PORTAL_FRAME)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
@ -292,8 +292,8 @@ public class GameManager implements Listener
|
|||||||
if (game.GetTeamList().size() == 2) color = ChatColor.GREEN;
|
if (game.GetTeamList().size() == 2) color = ChatColor.GREEN;
|
||||||
if (game.GetTeamList().size() == 3) color = ChatColor.AQUA;
|
if (game.GetTeamList().size() == 3) color = ChatColor.AQUA;
|
||||||
if (game.GetTeamList().size() == 4) color = ChatColor.GOLD;
|
if (game.GetTeamList().size() == 4) color = ChatColor.GOLD;
|
||||||
if (game.GetTeamList().size() == 5) color = ChatColor.DARK_BLUE;
|
if (game.GetTeamList().size() == 5) color = ChatColor.LIGHT_PURPLE;
|
||||||
if (game.GetTeamList().size() == 6) color = ChatColor.LIGHT_PURPLE;
|
if (game.GetTeamList().size() == 6) color = ChatColor.DARK_BLUE;
|
||||||
if (game.GetTeamList().size() == 7) color = ChatColor.WHITE;
|
if (game.GetTeamList().size() == 7) color = ChatColor.WHITE;
|
||||||
if (game.GetTeamList().size() == 8) color = ChatColor.BLUE;
|
if (game.GetTeamList().size() == 8) color = ChatColor.BLUE;
|
||||||
if (game.GetTeamList().size() == 9) color = ChatColor.DARK_GREEN;
|
if (game.GetTeamList().size() == 9) color = ChatColor.DARK_GREEN;
|
||||||
|
Loading…
Reference in New Issue
Block a user