MineStrike fixes
This commit is contained in:
parent
09a3cc16b0
commit
fed3d31374
@ -113,4 +113,21 @@ public class UtilTitle
|
||||
}
|
||||
}
|
||||
|
||||
public static String progress(float exp)
|
||||
{
|
||||
String out = "";
|
||||
|
||||
for (int i=0 ; i<40 ; i++)
|
||||
{
|
||||
float cur = i * (1f /40f);
|
||||
|
||||
if (cur < exp)
|
||||
out += C.cGreen + C.Bold + "|";
|
||||
else
|
||||
out += C.cGray + C.Bold + "|";
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new MorphBlock(this));
|
||||
addGadget(new MorphEnderman(this));
|
||||
addGadget(new MorphBat(this));
|
||||
addGadget(new MorphNotch(this));
|
||||
//addGadget(new MorphNotch(this));
|
||||
addGadget(new MorphPumpkinKing(this));
|
||||
addGadget(new MorphPig(this));
|
||||
addGadget(new MorphCreeper(this));
|
||||
|
@ -42,6 +42,7 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
@ -680,6 +681,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
GetDisguise().undisguise(player);
|
||||
}
|
||||
|
||||
public void RefreshPlayers()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
player.hidePlayer(other);
|
||||
player.showPlayer(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> LoadFiles(String gameName)
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ public class MineStrike extends TeamGame
|
||||
//"Tap Crouch when close to an ally to Boost",
|
||||
"Open Inventory at spawn to buy guns",
|
||||
"Hold Right-Click to Plant Bomb",
|
||||
"Hold Right-Click with knife to Defuse Bomb",
|
||||
"Look at the Bomb to Defuse Bomb",
|
||||
"Moving decreases accuracy",
|
||||
"Sprinting heavily decreases accuracy",
|
||||
"Jumping massively decreases accuracy",
|
||||
@ -1402,8 +1402,8 @@ public class MineStrike extends TeamGame
|
||||
if (!_bombPlanter.isBlocking())
|
||||
{
|
||||
_bombPlanter.setExp(0f);
|
||||
UtilTitle.clear(_bombPlanter);
|
||||
_bombPlanter = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1411,7 +1411,9 @@ public class MineStrike extends TeamGame
|
||||
|
||||
if (Math.random() > 0.90)
|
||||
_bombPlanter.getWorld().playSound(_bombPlanter.getLocation(), Sound.NOTE_PLING, 1f, 3f);
|
||||
|
||||
|
||||
UtilTitle.display(C.cRed + C.Bold + "Planting Bomb", UtilTitle.progress(_bombPlanter.getExp()), 0, 10, 0, _bombPlanter);
|
||||
|
||||
if (_bombPlanter.getExp() >= 0.98f)
|
||||
{
|
||||
_bomb = new Bomb(_bombPlanter);
|
||||
@ -1439,9 +1441,9 @@ public class MineStrike extends TeamGame
|
||||
if (UtilMath.offset(event.getFrom(), event.getTo()) > 0)
|
||||
event.setTo(event.getFrom());
|
||||
|
||||
if (_bombDefuser != null && _bombDefuser.equals(event.getPlayer()))
|
||||
if (UtilMath.offset(event.getFrom(), event.getTo()) > 0)
|
||||
event.setTo(event.getFrom());
|
||||
// if (_bombDefuser != null && _bombDefuser.equals(event.getPlayer()))
|
||||
// if (UtilMath.offset(event.getFrom(), event.getTo()) > 0)
|
||||
// event.setTo(event.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1452,59 +1454,44 @@ public class MineStrike extends TeamGame
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.SHEARS))
|
||||
return;
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", F.elem(C.cGreen + "Right-Click") + " with your " + F.elem("Knife") + " to defuse bombs."));
|
||||
UtilPlayer.message(player, F.main("Game", "Look at the Bomb to defuse it."));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void defuseBomb(PlayerInteractEvent event)
|
||||
public void startDefuse()
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true))
|
||||
{
|
||||
if (_bomb != null && event.getClickedBlock() == null && _bomb.isBlock(event.getClickedBlock()))
|
||||
Block block = player.getTargetBlock(null, 5);
|
||||
|
||||
if (block == null || !_bomb.isBlock(block))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
|
||||
continue;
|
||||
|
||||
if (_bombDefuser != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Hold Right-Click to defuse the Bomb!"));
|
||||
return;
|
||||
if (Recharge.Instance.use(player, "Defuse Message", 2000, false, false))
|
||||
UtilPlayer.message(player, F.main("Game", _bombDefuser.getName() + " is already defusing the Bomb."));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
return;
|
||||
_bombDefuser = player;
|
||||
_bombDefuser.setExp(0f);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You are defusing the Bomb."));
|
||||
|
||||
_bombDefuser.getWorld().playSound(_bombDefuser.getLocation(), Sound.PISTON_RETRACT, 2f, 1f);
|
||||
}
|
||||
|
||||
if (_bomb == null || event.getClickedBlock() == null || !_bomb.isBlock(event.getClickedBlock()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You must be looking at the Bomb to defuse."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilEnt.isGrounded(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You can only defuse Bomb while on the ground!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_bombDefuser != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", _bombDefuser.getName() + " is already defusing the Bomb."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_bombDefuser = player;
|
||||
_bombDefuser.setExp(0f);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You are defusing the Bomb."));
|
||||
|
||||
_bombDefuser.getWorld().playSound(_bombDefuser.getLocation(), Sound.PISTON_RETRACT, 2f, 1f);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void defuseBombUpdate(UpdateEvent event)
|
||||
{
|
||||
if (_bomb == null)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
@ -1512,9 +1499,16 @@ public class MineStrike extends TeamGame
|
||||
return;
|
||||
|
||||
if (_bombDefuser == null)
|
||||
return;
|
||||
{
|
||||
startDefuse();
|
||||
}
|
||||
|
||||
if (!_bombDefuser.isBlocking())
|
||||
if (_bombDefuser == null)
|
||||
return;
|
||||
|
||||
Block block = _bombDefuser.getTargetBlock(null, 5);
|
||||
|
||||
if (block == null || !_bomb.isBlock(block) || UtilMath.offset(_bombDefuser.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
|
||||
{
|
||||
_bombDefuser.setExp(0f);
|
||||
_bombDefuser = null;
|
||||
@ -1528,6 +1522,8 @@ public class MineStrike extends TeamGame
|
||||
|
||||
_bombDefuser.setExp(Math.min(_bombDefuser.getExp() + defuseRate, 0.99999f));
|
||||
|
||||
UtilTitle.display(C.cAqua + C.Bold + "Defusing Bomb", UtilTitle.progress(_bombDefuser.getExp()), 0, 10, 0, _bombDefuser);
|
||||
|
||||
if (_bombDefuser.getExp() >= 0.98f)
|
||||
{
|
||||
_bomb.defuse();
|
||||
@ -1798,12 +1794,10 @@ public class MineStrike extends TeamGame
|
||||
player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 2f);
|
||||
Manager.GetCondition().Factory().Blind("Respawn", player, null, 2, 0, false, false, false);
|
||||
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + ". Open your Inventory to spend it."));
|
||||
|
||||
UtilTitle.display(C.cGreen + "$" + _shopManager.getMoney(player), "Open your Inventory to buy new equipment", 10, 120, 10, player);
|
||||
}
|
||||
|
||||
//Give Bomb
|
||||
Player player = UtilAlg.Random(GetTeam(ChatColor.RED).GetPlayers(true));
|
||||
giveBombToPlayer(player);
|
||||
|
||||
//Update Scoreboard Teams
|
||||
for (GameTeam team : GetTeamList())
|
||||
for (Player teamMember : team.GetPlayers(true))
|
||||
@ -1985,6 +1979,13 @@ public class MineStrike extends TeamGame
|
||||
else
|
||||
player.playSound(player.getLocation(), Sound.NOTE_SNARE_DRUM, 1f, 1f);
|
||||
}
|
||||
|
||||
if (_freezeTime == 0)
|
||||
{
|
||||
//Give Bomb
|
||||
Player bombPlayer = UtilAlg.Random(GetTeam(ChatColor.RED).GetPlayers(true));
|
||||
giveBombToPlayer(bombPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1993,9 +1994,12 @@ public class MineStrike extends TeamGame
|
||||
if (_freezeTime <= 0)
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0)
|
||||
return;
|
||||
|
||||
|
||||
event.getFrom().setPitch(event.getTo().getPitch());
|
||||
event.getFrom().setYaw(event.getTo().getYaw());
|
||||
|
||||
@ -2465,6 +2469,12 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
return _bulletInstant;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void joinMessage(PlayerJoinEvent event)
|
||||
{
|
||||
UtilTitle.display(C.cGold + C.Bold + "MineStrike", "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void debug(PlayerCommandPreprocessEvent event)
|
||||
|
@ -160,7 +160,7 @@ public abstract class StrikeItem
|
||||
public void fixStackName()
|
||||
{
|
||||
ItemMeta meta = _stack.getItemMeta();
|
||||
meta.setDisplayName((_ownerName == null ? "" : _ownerName + "'s ") + C.Bold + getName() + ChatColor.RESET);
|
||||
meta.setDisplayName(ChatColor.RESET + (_ownerName == null ? "" : _ownerName + "'s ") + C.Bold + getName() + ChatColor.RESET);
|
||||
_stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public abstract class Gun extends StrikeItem
|
||||
public void updateWeaponName(Player player)
|
||||
{
|
||||
ItemMeta meta = getStack().getItemMeta();
|
||||
meta.setDisplayName((getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo);
|
||||
meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo);
|
||||
getStack().setItemMeta(meta);
|
||||
|
||||
if (player != null)
|
||||
|
@ -253,6 +253,15 @@ public class GameManager implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void VisibilityRefresh(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
Manager.RefreshPlayers();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void KitRegister(GameStateChangeEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user