- Fixed using water in restricted zones in MCL

- Implemented Elo in /stats menu
This commit is contained in:
AlexTheCoder 2016-04-28 00:53:04 -04:00
parent 46f873634e
commit 189296a586
4 changed files with 156 additions and 1 deletions

View File

@ -130,6 +130,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
addBackButton();
addStats();
addDivisionDisplay();
}
private void addBackButton()

View File

@ -1989,4 +1989,84 @@ public class MinecraftLeague extends RankedTeamGame
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handlePlace(PlayerBucketEmptyEvent event)
{
if (!IsLive())
return;
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
for (Location red : GetTeam(ChatColor.RED).GetSpawns())
{
if (UtilMath.offset(red, block.getLocation()) < 5)
{
event.setCancelled(true);
return;
}
}
for (Location blue : GetTeam(ChatColor.AQUA).GetSpawns())
{
if (UtilMath.offset(blue, block.getLocation()) < 5)
{
event.setCancelled(true);
return;
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.RED)))
{
if (UtilMath.offset(base.getLocation(), block.getLocation()) <= 7)
{
event.setCancelled(true);
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.AQUA)))
{
if (UtilMath.offset(base.getLocation(), block.getLocation()) <= 7)
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handleBreak(PlayerBucketFillEvent event)
{
if (!IsLive())
return;
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
for (Location red : GetTeam(ChatColor.RED).GetSpawns())
{
if (UtilMath.offset(red, block.getLocation()) < 5)
{
event.setCancelled(true);
return;
}
}
for (Location blue : GetTeam(ChatColor.AQUA).GetSpawns())
{
if (UtilMath.offset(blue, block.getLocation()) < 5)
{
event.setCancelled(true);
return;
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.RED)))
{
if (UtilMath.offset(base.getLocation(), block.getLocation()) <= 7)
{
event.setCancelled(true);
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.AQUA)))
{
if (UtilMath.offset(base.getLocation(), block.getLocation()) <= 7)
{
event.setCancelled(true);
}
}
}
}

View File

@ -7,6 +7,7 @@ import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
@ -32,6 +33,7 @@ import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
@ -41,6 +43,7 @@ import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@ -379,6 +382,40 @@ public class WitherVariation extends GameVariation
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handlePlace(PlayerBucketEmptyEvent event)
{
if (!Host.IsLive())
return;
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
for (TeamAltar altar : _altars.values())
{
if (!altar.canPlace(event.getPlayer(), Material.WATER, block.getLocation(), true))
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handleBreak(PlayerBucketEmptyEvent event)
{
if (!Host.IsLive())
return;
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
for (TeamAltar altar : _altars.values())
{
if (!altar.canBreak(event.getPlayer(), block, true))
{
event.setCancelled(true);
}
}
}
@EventHandler
public void onShoot(ProjectileLaunchEvent event)
{

View File

@ -24,7 +24,6 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.minecraftleague.data.MapZone;
import nautilus.game.arcade.game.games.minecraftleague.tracker.GrabSkullEvent;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation;
@ -50,6 +49,8 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
@ -444,6 +445,42 @@ public class WitherMinionManager implements Listener
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handlePlace(PlayerBucketEmptyEvent event)
{
if (!_host.Host.IsLive())
return;
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
for (Location check : _spawns)
{
if (UtilMath.offset(check, block.getLocation()) < 5)
{
event.setCancelled(true);
return;
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handleBreak(PlayerBucketFillEvent event)
{
if (!_host.Host.IsLive())
return;
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
for (Location check : _spawns)
{
if (UtilMath.offset(check, block.getLocation()) < 5)
{
event.setCancelled(true);
return;
}
}
}
@EventHandler
public void onExp(EntityExplodeEvent event)
{