Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
28927a5965
5
.gitignore
vendored
5
.gitignore
vendored
@ -34,3 +34,8 @@ Debug
|
||||
/Plugins/Cube/plugin.yml
|
||||
/Plugins/Cube/src/mastaG/Cube/Cube.java
|
||||
/Plugins/Libraries/spigot_server.jar
|
||||
xOlibro
|
||||
zBench
|
||||
zMyst
|
||||
zSotanna
|
||||
zSotanna2
|
||||
|
@ -43,6 +43,8 @@ import org.bukkit.util.Vector;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
@ -95,8 +97,13 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
private ArrayList<Location> _lavaSource = new ArrayList<Location>();
|
||||
|
||||
//Lilly Pad Bridge
|
||||
private ArrayList<Location> _lillyPads = new ArrayList<Location>();
|
||||
|
||||
private NautHashMap<Location, Long> _lillyPads = new NautHashMap<Location, Long>();
|
||||
|
||||
//Mushrooms
|
||||
private NautHashMap<Location, Long> _mushroomStem = new NautHashMap<Location, Long>();
|
||||
private NautHashMap<Location, Long> _mushroomTop = new NautHashMap<Location, Long>();
|
||||
private boolean _stemsGrown = false;
|
||||
|
||||
//Ice
|
||||
private ArrayList<Location> _iceBridge = new ArrayList<Location>();
|
||||
|
||||
@ -234,11 +241,16 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
||||
{
|
||||
WorldWaterDamage = 4;
|
||||
}
|
||||
|
||||
if (WorldWaterDamage > 0)
|
||||
{
|
||||
@ -259,7 +271,8 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
ParseWoodBridge();
|
||||
ParseIceBridge();
|
||||
ParseLillyPad();
|
||||
|
||||
ParseMushrooms();
|
||||
|
||||
ParseChests();
|
||||
|
||||
ParseOre(WorldData.GetCustomLocs("73")); // Red
|
||||
@ -650,12 +663,29 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
|
||||
private void ParseIceBridge()
|
||||
{
|
||||
_iceBridge = WorldData.GetCustomLocs("LIGHT_BLUE");
|
||||
_iceBridge = WorldData.GetDataLocs("LIGHT_BLUE");
|
||||
}
|
||||
|
||||
private void ParseMushrooms()
|
||||
{
|
||||
for (Location loc : WorldData.GetCustomLocs("21"))
|
||||
{
|
||||
_mushroomStem.put(loc, 0L);
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
for (Location loc : WorldData.GetDataLocs("PURPLE"))
|
||||
{
|
||||
_mushroomTop.put(loc, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseLillyPad()
|
||||
{
|
||||
_lillyPads = WorldData.GetDataLocs("LIME");
|
||||
for (Location loc : WorldData.GetDataLocs("LIME"))
|
||||
{
|
||||
_lillyPads.put(loc, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -690,6 +720,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
BuildLava();
|
||||
BuildIce();
|
||||
BuildLillyPad();
|
||||
buildMushroom();
|
||||
}
|
||||
|
||||
private void BuildLava()
|
||||
@ -725,11 +756,14 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
|
||||
private void BuildLillyPad()
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (_lillyPads != null && !_lillyPads.isEmpty())
|
||||
{
|
||||
// Random Block
|
||||
Location loc = _lillyPads.get(UtilMath.r(_lillyPads.size()));
|
||||
Location loc = UtilAlg.Random(_lillyPads.keySet());
|
||||
|
||||
if (!UtilTime.elapsed(_lillyPads.get(loc), 8000))
|
||||
continue;
|
||||
|
||||
if (!loc.getBlock().getRelative(BlockFace.DOWN).isLiquid())
|
||||
continue;
|
||||
@ -743,19 +777,116 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void breakLillyPad(BlockBreakEvent event)
|
||||
{
|
||||
if (event.getBlock().getType() != Material.WATER_LILY)
|
||||
return;
|
||||
|
||||
_lillyPads.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
|
||||
private void buildMushroom()
|
||||
{
|
||||
if (_mushroomStem != null && !_mushroomStem.isEmpty())
|
||||
{
|
||||
for (int i=0 ; i<4 && !_mushroomStem.isEmpty() ; i++)
|
||||
{
|
||||
double lowestY = 0;
|
||||
Location lowestLoc = null;
|
||||
|
||||
for (Location loc : _mushroomStem.keySet())
|
||||
{
|
||||
if (!UtilTime.elapsed(_mushroomStem.get(loc), 6000))
|
||||
continue;
|
||||
|
||||
if (lowestLoc == null || loc.getY() < lowestY)
|
||||
{
|
||||
lowestY = loc.getY();
|
||||
lowestLoc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
if (lowestLoc == null)
|
||||
continue;
|
||||
|
||||
_mushroomStem.remove(lowestLoc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(lowestLoc, 100, (byte)15);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_stemsGrown = true;
|
||||
}
|
||||
|
||||
if (_stemsGrown && _mushroomTop != null && !_mushroomTop.isEmpty())
|
||||
{
|
||||
int attempts = 0;
|
||||
int done = 0;
|
||||
while (done < 6 && attempts < 400)
|
||||
{
|
||||
attempts++;
|
||||
|
||||
// Random Block
|
||||
Location loc = UtilAlg.Random(_mushroomTop.keySet());
|
||||
|
||||
if (!UtilTime.elapsed(_mushroomTop.get(loc), 6000))
|
||||
continue;
|
||||
|
||||
Block block = loc.getBlock();
|
||||
|
||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.NORTH).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.EAST).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.SOUTH).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.WEST).getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
_mushroomTop.remove(loc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), 99, (byte)14);
|
||||
|
||||
done++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void breakMushroom(BlockBreakEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
if (event.getBlock().getTypeId() == 100 &&
|
||||
WorldData.GetCustomLocs("21").contains(event.getBlock().getLocation().add(0.5, 0, 0.5)))
|
||||
{
|
||||
_mushroomStem.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
|
||||
if (event.getBlock().getTypeId() == 99 &&
|
||||
WorldData.GetDataLocs("PURPLE").contains(event.getBlock().getLocation().add(0.5, 0, 0.5)))
|
||||
{
|
||||
_mushroomTop.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildIce()
|
||||
{
|
||||
if (UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 120000))
|
||||
if (_iceBridge == null || _iceBridge.isEmpty() || UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 120000))
|
||||
{
|
||||
WorldData.World.setStorm(false);
|
||||
return;
|
||||
}
|
||||
|
||||
WorldData.World.setStorm(true);
|
||||
|
||||
|
||||
int attempts = 0;
|
||||
int done = 0;
|
||||
while (done < 2 && attempts < 500 && _iceBridge != null && !_iceBridge.isEmpty())
|
||||
while (done < 5 && attempts < 400)
|
||||
{
|
||||
attempts++;
|
||||
|
||||
@ -776,12 +907,9 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
_iceBridge.remove(loc);
|
||||
|
||||
if (Math.random() > 0.25)
|
||||
MapUtil.QuickChangeBlockAt(loc, Material.PACKED_ICE);
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.PACKED_ICE);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(loc, Material.ICE);
|
||||
|
||||
// Sound
|
||||
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, Material.ICE);
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.ICE);
|
||||
|
||||
done++;
|
||||
}
|
||||
@ -1242,7 +1370,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
//Display Individual Players
|
||||
if (this.GetPlayers(true).size() < 10)
|
||||
if (this.GetPlayers(true).size() < 8)
|
||||
{
|
||||
if (!team.IsTeamAlive())
|
||||
continue;
|
||||
@ -1662,9 +1790,12 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void toggleOre(PlayerCommandPreprocessEvent event)
|
||||
public void debug(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getPlayer().isOp() && event.getMessage().contains("/oretoggle"))
|
||||
_ore.ToggleVisibility();
|
||||
|
||||
if (event.getPlayer().isOp() && event.getMessage().contains("/bridge"))
|
||||
_bridgeTime = 30000;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user