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;
|
||||
}
|
||||
if(!Host._currentCrumble)
|
||||
if(!Host.isCrumbling())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -257,7 +257,7 @@ public abstract class Challenge implements Listener
|
||||
|
||||
if(_modifiedBlocks.isEmpty())
|
||||
{
|
||||
Host._currentCrumble = false;
|
||||
Host.setCrumbling(false);
|
||||
return;
|
||||
}
|
||||
for(Block currentBlock: _modifiedBlocks)
|
||||
@ -334,7 +334,7 @@ public abstract class Challenge implements Listener
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(Host._currentCrumble == false)
|
||||
if(!Host.isCrumbling())
|
||||
{
|
||||
Lost.add(player);
|
||||
}
|
||||
@ -500,16 +500,6 @@ public abstract class Challenge implements Listener
|
||||
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()
|
||||
{
|
||||
return !Completed.isEmpty();
|
||||
|
@ -16,12 +16,14 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@ -113,6 +115,10 @@ public class MineWare extends TeamGame implements IThrown
|
||||
// Used for testing.
|
||||
private int _livesAmount = 1;
|
||||
|
||||
// Testing related commands.
|
||||
private String _restrictCommand = "restrict";
|
||||
private String _skipCommand = "skip";
|
||||
|
||||
// All players that will participate on challenges.
|
||||
private GameTeam _playersTeam;
|
||||
|
||||
@ -121,7 +127,7 @@ public class MineWare extends TeamGame implements IThrown
|
||||
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
public boolean _currentCrumble = false;
|
||||
private boolean _currentCrumble = false;
|
||||
private boolean _waitingChallenge = true;
|
||||
private boolean _allMessageSent = false;
|
||||
private boolean _sendingMessages = false;
|
||||
@ -151,20 +157,21 @@ public class MineWare extends TeamGame implements IThrown
|
||||
}
|
||||
);
|
||||
|
||||
DamageSelf = false;
|
||||
DamageTeamSelf = true;
|
||||
DamagePvP = false;
|
||||
DamagePvE = false;
|
||||
DamageEvP = false;
|
||||
DamageFall = false;
|
||||
InventoryClick = true;
|
||||
DamageSelf = false;
|
||||
|
||||
DeathOut = false;
|
||||
DeathTeleport = false;
|
||||
AutomaticRespawn = false;
|
||||
DeathMessages = false;
|
||||
GiveClock = false;
|
||||
CreatureAllow = true;
|
||||
|
||||
TeleportsDisqualify = false;
|
||||
GiveClock = false;
|
||||
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
@ -187,8 +194,6 @@ public class MineWare extends TeamGame implements IThrown
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
_playersTeam = GetTeamList().get(0);
|
||||
_playersTeam.SetColor(ChatColor.YELLOW);
|
||||
_playersTeam.SetName("Players");
|
||||
}
|
||||
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
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventHandler
|
||||
public void onDebugCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
String restrictCommand = "restrict";
|
||||
String skipCommand = "skip";
|
||||
String message = event.getMessage();
|
||||
|
||||
if (player.isOp())
|
||||
{
|
||||
if (message.startsWith("/" + restrictCommand))
|
||||
if (message.startsWith("/" + _restrictCommand))
|
||||
{
|
||||
String[] pieces = message.split(" ");
|
||||
|
||||
@ -229,11 +249,11 @@ public class MineWare extends TeamGame implements IThrown
|
||||
}
|
||||
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)
|
||||
{
|
||||
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
|
||||
@ -245,7 +265,7 @@ public class MineWare extends TeamGame implements IThrown
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (message.startsWith("/" + skipCommand))
|
||||
else if (message.startsWith("/" + _skipCommand))
|
||||
{
|
||||
if (IsLive())
|
||||
{
|
||||
@ -256,7 +276,7 @@ public class MineWare extends TeamGame implements IThrown
|
||||
}
|
||||
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);
|
||||
@ -339,7 +359,7 @@ public class MineWare extends TeamGame implements IThrown
|
||||
|
||||
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);
|
||||
Manager.GetLobby().DisplayWaiting();
|
||||
}
|
||||
@ -369,6 +389,7 @@ public class MineWare extends TeamGame implements IThrown
|
||||
|
||||
if (living <= 1)
|
||||
{
|
||||
SetCustomWinLine("You have defeated Bawk Bawk!");
|
||||
Collections.reverse(_places);
|
||||
|
||||
if (!_places.contains(GetPlayers(true).get(0)))
|
||||
@ -1279,6 +1300,26 @@ public class MineWare extends TeamGame implements IThrown
|
||||
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
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ public class ChallengeRushPush extends Challenge
|
||||
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);
|
||||
}
|
||||
@ -151,7 +151,7 @@ public class ChallengeRushPush extends Challenge
|
||||
event.SetCancelled("Player out of the game");
|
||||
return;
|
||||
}
|
||||
if (!Host._currentCrumble)
|
||||
if (!Host.isCrumbling())
|
||||
{
|
||||
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.UtilTextMiddle;
|
||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
|
||||
public class ChickenAttack
|
||||
@ -29,8 +28,6 @@ public class ChickenAttack
|
||||
private JavaPlugin _plugin;
|
||||
|
||||
private Location _center;
|
||||
private World _world;
|
||||
|
||||
private Location _corner1;
|
||||
private Location _corner2;
|
||||
|
||||
@ -44,7 +41,6 @@ public class ChickenAttack
|
||||
_plugin = host.getArcadeManager().getPlugin();
|
||||
|
||||
_center = center.clone().add(0, 1.0, 0);
|
||||
_world = center.getWorld();
|
||||
_corner1 = corner1;
|
||||
_corner2 = corner2;
|
||||
|
||||
@ -143,6 +139,11 @@ public class ChickenAttack
|
||||
// TODO: Make chickens attack player.
|
||||
}
|
||||
|
||||
public boolean isGroupMember(Chicken chicken)
|
||||
{
|
||||
return _chickens.contains(chicken);
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
for (Chicken chicken : _chickens)
|
||||
|
Loading…
Reference in New Issue
Block a user