Chicken attack changes, refactoring, update map crumble variable access.
This commit is contained in:
parent
c5a9f0c42c
commit
e3a9f4f2f7
@ -1 +1 @@
|
|||||||
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"]]
|
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core.Common","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core.Common"}},"ABSENT"]]
|
@ -248,7 +248,7 @@ public abstract class Challenge implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!Host._currentCrumble)
|
if(!Host.isCrumbling())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ public abstract class Challenge implements Listener
|
|||||||
|
|
||||||
if(_modifiedBlocks.isEmpty())
|
if(_modifiedBlocks.isEmpty())
|
||||||
{
|
{
|
||||||
Host._currentCrumble = false;
|
Host.setCrumbling(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(Block currentBlock: _modifiedBlocks)
|
for(Block currentBlock: _modifiedBlocks)
|
||||||
@ -334,7 +334,7 @@ public abstract class Challenge implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Host._currentCrumble == false)
|
if(!Host.isCrumbling())
|
||||||
{
|
{
|
||||||
Lost.add(player);
|
Lost.add(player);
|
||||||
}
|
}
|
||||||
@ -499,16 +499,6 @@ public abstract class Challenge implements Listener
|
|||||||
{
|
{
|
||||||
return _center.clone();
|
return _center.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Only set this to true if you put <br>
|
|
||||||
* The "Crumble" in the challenge constructor to <b>True!<b>
|
|
||||||
* @param condition
|
|
||||||
*/
|
|
||||||
public void setMapCrumble(boolean condition)
|
|
||||||
{
|
|
||||||
Host._currentCrumble = condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasWinner()
|
public boolean hasWinner()
|
||||||
{
|
{
|
||||||
|
@ -16,12 +16,14 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Chicken;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -113,15 +115,19 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
// Used for testing.
|
// Used for testing.
|
||||||
private int _livesAmount = 1;
|
private int _livesAmount = 1;
|
||||||
|
|
||||||
|
// Testing related commands.
|
||||||
|
private String _restrictCommand = "restrict";
|
||||||
|
private String _skipCommand = "skip";
|
||||||
|
|
||||||
// All players that will participate on challenges.
|
// All players that will participate on challenges.
|
||||||
private GameTeam _playersTeam;
|
private GameTeam _playersTeam;
|
||||||
|
|
||||||
// All players that have lost their lives and are spectating with a baby chicken morph.
|
// All players that have lost their lives and are spectating with a baby chicken morph.
|
||||||
private GameTeam _chickenTeam;
|
private GameTeam _chickenTeam;
|
||||||
|
|
||||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||||
|
|
||||||
public boolean _currentCrumble = false;
|
private boolean _currentCrumble = false;
|
||||||
private boolean _waitingChallenge = true;
|
private boolean _waitingChallenge = true;
|
||||||
private boolean _allMessageSent = false;
|
private boolean _allMessageSent = false;
|
||||||
private boolean _sendingMessages = false;
|
private boolean _sendingMessages = false;
|
||||||
@ -151,20 +157,21 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DamageSelf = false;
|
||||||
DamageTeamSelf = true;
|
DamageTeamSelf = true;
|
||||||
DamagePvP = false;
|
DamagePvP = false;
|
||||||
DamagePvE = false;
|
DamagePvE = false;
|
||||||
DamageEvP = false;
|
DamageEvP = false;
|
||||||
DamageFall = false;
|
DamageFall = false;
|
||||||
InventoryClick = true;
|
|
||||||
DamageSelf = false;
|
|
||||||
DeathOut = false;
|
DeathOut = false;
|
||||||
DeathTeleport = false;
|
DeathTeleport = false;
|
||||||
AutomaticRespawn = false;
|
AutomaticRespawn = false;
|
||||||
DeathMessages = false;
|
DeathMessages = false;
|
||||||
GiveClock = false;
|
|
||||||
CreatureAllow = true;
|
CreatureAllow = true;
|
||||||
|
|
||||||
TeleportsDisqualify = false;
|
TeleportsDisqualify = false;
|
||||||
|
GiveClock = false;
|
||||||
|
|
||||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||||
|
|
||||||
@ -187,8 +194,6 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
if (event.GetState() == GameState.Recruit)
|
if (event.GetState() == GameState.Recruit)
|
||||||
{
|
{
|
||||||
_playersTeam = GetTeamList().get(0);
|
_playersTeam = GetTeamList().get(0);
|
||||||
_playersTeam.SetColor(ChatColor.YELLOW);
|
|
||||||
_playersTeam.SetName("Players");
|
|
||||||
}
|
}
|
||||||
else if (event.GetState() == GameState.Live)
|
else if (event.GetState() == GameState.Live)
|
||||||
{
|
{
|
||||||
@ -198,19 +203,34 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onChickenAttackMemberDamage(EntityDamageEvent event)
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getEntity() instanceof Chicken)
|
||||||
|
{
|
||||||
|
Chicken chicken = (Chicken) event.getEntity();
|
||||||
|
|
||||||
|
if (_chickenAttack.isGroupMember(chicken))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Debug Only
|
// Debug Only
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDebugCommand(PlayerCommandPreprocessEvent event)
|
public void onDebugCommand(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String restrictCommand = "restrict";
|
|
||||||
String skipCommand = "skip";
|
|
||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
|
|
||||||
if (player.isOp())
|
if (player.isOp())
|
||||||
{
|
{
|
||||||
if (message.startsWith("/" + restrictCommand))
|
if (message.startsWith("/" + _restrictCommand))
|
||||||
{
|
{
|
||||||
String[] pieces = message.split(" ");
|
String[] pieces = message.split(" ");
|
||||||
|
|
||||||
@ -229,11 +249,11 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
catch (ClassNotFoundException e)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Debug", "Could not match " + F.elem(rawClass) + " with any challenges."));
|
UtilPlayer.message(player, F.main(GetType().GetName(), "Could not match " + F.elem(rawClass) + " with any challenges."));
|
||||||
}
|
}
|
||||||
catch (ClassCastException e)
|
catch (ClassCastException e)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Debug", F.elem(rawClass) + "is not a challenge!"));
|
UtilPlayer.message(player, F.main(GetType().GetName(), F.elem(rawClass) + "is not a challenge!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -245,18 +265,18 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
else if (message.startsWith("/" + skipCommand))
|
else if (message.startsWith("/" + _skipCommand))
|
||||||
{
|
{
|
||||||
if (IsLive())
|
if (IsLive())
|
||||||
{
|
{
|
||||||
endCurrentChallenge();
|
endCurrentChallenge();
|
||||||
_currentCrumble = false;
|
_currentCrumble = false;
|
||||||
|
|
||||||
Announce(C.cAqua + C.Bold + player.getName() + " skipped this challenge.");
|
Announce(C.cAqua + C.Bold + player.getName() + " skipped this challenge.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Debug", "You cannot skip a challenge if the game is not started."));
|
UtilPlayer.message(player, F.main(GetType().GetName(), "You cannot skip a challenge if the game is not started."));
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -270,7 +290,7 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
if (event.getEntity() instanceof ArmorStand)
|
if (event.getEntity() instanceof ArmorStand)
|
||||||
{
|
{
|
||||||
ArmorStand armorStand = (ArmorStand) event.getEntity();
|
ArmorStand armorStand = (ArmorStand) event.getEntity();
|
||||||
|
|
||||||
for (DeathEffectData data : _deathEffect.getData())
|
for (DeathEffectData data : _deathEffect.getData())
|
||||||
{
|
{
|
||||||
if (data.getChickenHead().equals(armorStand))
|
if (data.getChickenHead().equals(armorStand))
|
||||||
@ -339,7 +359,7 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
|
|
||||||
if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() < 2)
|
if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() < 2)
|
||||||
{
|
{
|
||||||
UtilServer.broadcast(F.main("MineWare", C.cRed + "This game requires at least 2 players to start."));
|
UtilServer.broadcast(F.main(GetType().GetName(), C.cRed + "This game requires at least 2 players to start."));
|
||||||
SetCountdown(-1);
|
SetCountdown(-1);
|
||||||
Manager.GetLobby().DisplayWaiting();
|
Manager.GetLobby().DisplayWaiting();
|
||||||
}
|
}
|
||||||
@ -369,11 +389,12 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
|
|
||||||
if (living <= 1)
|
if (living <= 1)
|
||||||
{
|
{
|
||||||
|
SetCustomWinLine("You have defeated Bawk Bawk!");
|
||||||
Collections.reverse(_places);
|
Collections.reverse(_places);
|
||||||
|
|
||||||
if (!_places.contains(GetPlayers(true).get(0)))
|
if (!_places.contains(GetPlayers(true).get(0)))
|
||||||
_places.add(0, GetPlayers(true).get(0));
|
_places.add(0, GetPlayers(true).get(0));
|
||||||
|
|
||||||
if (_places.size() >= 1)
|
if (_places.size() >= 1)
|
||||||
{
|
{
|
||||||
AddGems(_places.get(0), 40, "First Place", false, false);
|
AddGems(_places.get(0), 40, "First Place", false, false);
|
||||||
@ -396,7 +417,7 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
AnnounceEnd(_places);
|
AnnounceEnd(_places);
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (living <= 1)
|
// if (living <= 1)
|
||||||
// {
|
// {
|
||||||
// SetState(GameState.End);
|
// SetState(GameState.End);
|
||||||
@ -1262,23 +1283,43 @@ public class MineWare extends TeamGame implements IThrown
|
|||||||
{
|
{
|
||||||
return _isChallengeStarted;
|
return _isChallengeStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameTeam getPlayersTeam()
|
public GameTeam getPlayersTeam()
|
||||||
{
|
{
|
||||||
return _playersTeam;
|
return _playersTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameTeam getChickenTeam()
|
public GameTeam getChickenTeam()
|
||||||
{
|
{
|
||||||
return _chickenTeam;
|
return _chickenTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<Player> getWinners()
|
public ArrayList<Player> getWinners()
|
||||||
{
|
{
|
||||||
return _places;
|
return _places;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DeathEffect getDeathEffect()
|
||||||
|
{
|
||||||
|
return _deathEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChickenAttack getChickenAttack()
|
||||||
|
{
|
||||||
|
return _chickenAttack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCrumbling(boolean crumbling)
|
||||||
|
{
|
||||||
|
_currentCrumble = crumbling;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCrumbling()
|
||||||
|
{
|
||||||
|
return _currentCrumble;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Idle(ProjectileUser data)
|
public void Idle(ProjectileUser data)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ public class ChallengeRushPush extends Challenge
|
|||||||
onRed++;
|
onRed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((onBlue == 0 || onRed == 0) && Host._currentCrumble == false)
|
if((onBlue == 0 || onRed == 0) && Host.isCrumbling() == false)
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(onBlue == 0 ? C.cBlue + "Blue Team won!" : C.cRed + "Red Team won!", "Friendly fire enabled!", 20, 60, 20);
|
UtilTextMiddle.display(onBlue == 0 ? C.cBlue + "Blue Team won!" : C.cRed + "Red Team won!", "Friendly fire enabled!", 20, 60, 20);
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ public class ChallengeRushPush extends Challenge
|
|||||||
event.SetCancelled("Player out of the game");
|
event.SetCancelled("Player out of the game");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Host._currentCrumble)
|
if (!Host.isCrumbling())
|
||||||
{
|
{
|
||||||
if (_teams.containsKey(event.GetDamagerPlayer(false).getName()))
|
if (_teams.containsKey(event.GetDamagerPlayer(false).getName()))
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,6 @@ import mineplex.core.common.util.UtilInv;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTextMiddle;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||||
import mineplex.core.visibility.VisibilityManager;
|
|
||||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||||
|
|
||||||
public class ChickenAttack
|
public class ChickenAttack
|
||||||
@ -29,8 +28,6 @@ public class ChickenAttack
|
|||||||
private JavaPlugin _plugin;
|
private JavaPlugin _plugin;
|
||||||
|
|
||||||
private Location _center;
|
private Location _center;
|
||||||
private World _world;
|
|
||||||
|
|
||||||
private Location _corner1;
|
private Location _corner1;
|
||||||
private Location _corner2;
|
private Location _corner2;
|
||||||
|
|
||||||
@ -44,7 +41,6 @@ public class ChickenAttack
|
|||||||
_plugin = host.getArcadeManager().getPlugin();
|
_plugin = host.getArcadeManager().getPlugin();
|
||||||
|
|
||||||
_center = center.clone().add(0, 1.0, 0);
|
_center = center.clone().add(0, 1.0, 0);
|
||||||
_world = center.getWorld();
|
|
||||||
_corner1 = corner1;
|
_corner1 = corner1;
|
||||||
_corner2 = corner2;
|
_corner2 = corner2;
|
||||||
|
|
||||||
@ -142,6 +138,11 @@ public class ChickenAttack
|
|||||||
|
|
||||||
// TODO: Make chickens attack player.
|
// TODO: Make chickens attack player.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGroupMember(Chicken chicken)
|
||||||
|
{
|
||||||
|
return _chickens.contains(chicken);
|
||||||
|
}
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user