fix supply chest protection, absorbtion effect, tnt and level bugs
This commit is contained in:
parent
a33b070ae7
commit
399ab5c363
@ -218,7 +218,7 @@ public enum GameType
|
||||
Pair<MinecraftVersion, String>[] _resourcePacks;
|
||||
Class<? extends Game> _gameClass;
|
||||
|
||||
GameMode[] _gameModes;
|
||||
private GameMode[] _gameModes;
|
||||
private boolean _gameMaps;
|
||||
|
||||
private int _gameId; // Unique identifying id for this gamemode (used for statistics)
|
||||
@ -322,14 +322,13 @@ public enum GameType
|
||||
return _display.getGameCategory();
|
||||
}
|
||||
|
||||
public String GetKitGameName()
|
||||
public String GetKitGameName(Game game)
|
||||
{
|
||||
return _display.getKitGameName();
|
||||
if (hasGamemodes())
|
||||
{
|
||||
return getModeGameType(game.getClass())._display.getKitGameName();
|
||||
}
|
||||
|
||||
public boolean isUsingGameModes()
|
||||
{
|
||||
return _gameMaps;
|
||||
return _display.getKitGameName();
|
||||
}
|
||||
|
||||
public GameType getModeGameType(Class<? extends Game> game)
|
||||
@ -343,4 +342,14 @@ public enum GameType
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isUsingGameModesMaps()
|
||||
{
|
||||
return _gameMaps;
|
||||
}
|
||||
|
||||
public boolean hasGamemodes()
|
||||
{
|
||||
return _gameModes.length != 0;
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
if (GetType().isUsingGameModes())
|
||||
if (GetType().isUsingGameModesMaps())
|
||||
{
|
||||
GameType mode = GetType().getModeGameType(getClass());
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class AbsorptionFix implements Listener
|
||||
{
|
||||
player.removePotionEffect(PotionEffectType.ABSORPTION);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
|
||||
player.setHealth(player.getMaxHealth());
|
||||
player.setHealth(player.getHealth() + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -21,6 +22,7 @@ import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -49,6 +51,8 @@ public class OverpoweredBridge extends Bridge
|
||||
|
||||
WorldBoundaryKill = true;
|
||||
|
||||
Manager.GetDamage().SetEnabled(false);
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@ -128,6 +132,10 @@ public class OverpoweredBridge extends Bridge
|
||||
public void supplyChest(PlayerPrepareTeleportEvent event)
|
||||
{
|
||||
Location chestLoc = event.GetPlayer().getLocation().clone().add(0, 0, 1);
|
||||
|
||||
while (chestLoc.getBlock().getType() == Material.CHEST)
|
||||
chestLoc.add(2, 0, 0);
|
||||
|
||||
_starterChests.put(event.GetPlayer(), chestLoc);
|
||||
|
||||
Block block = chestLoc.getBlock();
|
||||
@ -136,8 +144,9 @@ public class OverpoweredBridge extends Bridge
|
||||
|
||||
Chest chest = (Chest) block.getState();
|
||||
|
||||
event.GetPlayer().getLocation().getBlock().setType(Material.WALL_SIGN);
|
||||
Sign sign = (Sign) event.GetPlayer().getLocation().getBlock().getState();
|
||||
Block signBlock = chestLoc.clone().add(0, 0, -1).getBlock();
|
||||
signBlock.setType(Material.WALL_SIGN);
|
||||
Sign sign = (Sign) signBlock.getState();
|
||||
sign.setLine(0, "§b=============");
|
||||
sign.setLine(1, "§4§l" + event.GetPlayer().getName() + ChatColor.RESET + "§4's");
|
||||
sign.setLine(2, "§4Supply Chest");
|
||||
@ -182,19 +191,17 @@ public class OverpoweredBridge extends Bridge
|
||||
if (event.getClickedBlock().getType() != Material.CHEST)
|
||||
return;
|
||||
|
||||
for (Player player : _starterChests.keySet())
|
||||
{
|
||||
if (player == event.getPlayer())
|
||||
continue;
|
||||
event.setCancelled(disallow(event.getPlayer(), event.getClickedBlock()));
|
||||
}
|
||||
}
|
||||
|
||||
if (_starterChests.get(player).getBlock().getLocation()
|
||||
.equals(event.getClickedBlock().getLocation()))
|
||||
@EventHandler
|
||||
public void placeChest(BlockPlaceEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getBlockPlaced().getType() != Material.CHEST)
|
||||
return;
|
||||
|
||||
event.setCancelled(disallow(event.getPlayer(), event.getBlock()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -220,6 +227,32 @@ public class OverpoweredBridge extends Bridge
|
||||
}
|
||||
}
|
||||
|
||||
private boolean disallow(Player clicker, Block block)
|
||||
{
|
||||
for (Player player : _starterChests.keySet())
|
||||
{
|
||||
System.out.println("test4");
|
||||
if (player == clicker)
|
||||
continue;
|
||||
|
||||
System.out.println("test2");
|
||||
Location chest = _starterChests.get(player);
|
||||
|
||||
if (chest.getBlock().getLocation().equals(block.getLocation()))
|
||||
{
|
||||
System.out.println("test1");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Block surround : UtilBlock.getSurrounding(block, false))
|
||||
{
|
||||
if(chest.getBlock().getLocation().equals(surround.getLocation()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseOre(ArrayList<Location> teamOre)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
if (this.GetAvailability() == KitAvailability.Free ||
|
||||
Manager.hasKitsUnlocked(player) ||
|
||||
(this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) ||
|
||||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + this.GetName()) ||
|
||||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) ||
|
||||
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) ||
|
||||
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament)
|
||||
{
|
||||
@ -306,7 +306,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
{
|
||||
Manager.GetGame().SetKit(player, this, true);
|
||||
}
|
||||
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), this), CurrencyType.GEM, player));
|
||||
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this), CurrencyType.GEM, player));
|
||||
}
|
||||
else if (this.GetAvailability() == KitAvailability.Achievement)
|
||||
{
|
||||
|
@ -1177,7 +1177,7 @@ public class GameLobbyManager implements Listener
|
||||
Manager.hasKitsUnlocked(player) || //YouTube
|
||||
(ent.GetKit().GetAvailability() == KitAvailability.Achievement &&
|
||||
Manager.GetAchievement().hasCategory(player, ent.GetKit().getAchievementRequirement())) || //Achievement
|
||||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + ent.GetKit().GetName()) || //Green
|
||||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(game) + " " + ent.GetKit().GetName()) || //Green
|
||||
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF
|
||||
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old)
|
||||
Manager.GetServerConfig().Tournament) //Tournament
|
||||
|
Loading…
Reference in New Issue
Block a user