Merge branch 'MortensRawBugFixes' into thanos-mineware

Conflicts:
	Plugins/Mineplex.Core/.classpath
This commit is contained in:
Thanos paravantis 2015-12-26 12:29:26 +02:00
commit 499ad655c9
21 changed files with 338 additions and 135 deletions

2
.gitignore vendored
View File

@ -51,6 +51,4 @@ zSotanna2
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments.gen
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments_1
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/write.lock
/RemoteSystemsTempFiles/.project
/.recommenders/caches
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -1,6 +1,5 @@
package mineplex.bungee.motd;
import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@ -8,13 +7,12 @@ import java.util.Random;
import java.util.concurrent.TimeUnit;
import mineplex.serverdata.Region;
import mineplex.serverdata.data.BungeeServer;
import mineplex.serverdata.data.DataRepository;
import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ConnectionData;
import mineplex.serverdata.servers.ServerManager;
import mineplex.serverdata.servers.ConnectionData.ConnectionType;
import net.md_5.bungee.api.ChatColor;
import mineplex.serverdata.servers.ServerManager;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
@ -68,7 +66,7 @@ public class MotdManager implements Listener, Runnable
@EventHandler
public void serverPing(ProxyPingEvent event)
{
net.md_5.bungee.api.ServerPing serverPing = event.getResponse();
ServerPing serverPing = event.getResponse();
String motd = _firstLine;
if (_motdLines != null && _motdLines.size() > 0)

View File

@ -9,6 +9,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.cache.CacheBuilder;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;

View File

@ -9,6 +9,7 @@ import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -52,7 +53,9 @@ import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.holeinwall.KitNormal;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeAnvilDance;
@ -102,16 +105,17 @@ import nautilus.game.arcade.kit.Kit;
public class MineWare extends SoloGame implements IThrown
{
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private Challenge _challenge;
private ArrayList<Block> _lastOrderBlocks;
private long _challengeTime;
public boolean _currentCrumble = false;
private boolean _waitingChallenge = true;
private boolean _allMessageSent = false;
private boolean _sendingMessages = false;
private boolean _isChallengeStarted = false;
private long _challengeTime;
private Challenge _challenge;
private ArrayList<Block> _lastOrderBlocks;
private ArrayList<Player> _places = new ArrayList<Player>();
private ArrayList<Class<? extends Challenge>> _challenges = new ArrayList<Class<? extends Challenge>>();
private ArrayList<Class<? extends Challenge>> _challengesCopy = new ArrayList<Class<? extends Challenge>>();
@ -181,9 +185,27 @@ public class MineWare extends SoloGame implements IThrown
{
SetState(GameState.End);
AnnounceEnd(getWinners());
for(Player players: GetPlayers(false))
{
if(getWinners().contains(players))
{
AddGems(players, 40, "1st Place", false, false);
}
if(_places.size() >= 1)
{
AddGems(_places.get(0), 20, "Third Place", false, false);
}
if(_places.size() >= 2)
{
AddGems(_places.get(1), 30, "Second Place", false, false);
}
AddGems(players, 10, "Participation", false, false);
}
}
}
@Override
public boolean isInsideMap(Player player)
{
@ -260,36 +282,35 @@ public class MineWare extends SoloGame implements IThrown
{
if (_challengesCopy.isEmpty())
{
Bukkit.broadcastMessage("Adding all games to list");
_challengesCopy.addAll(_challenges);
}
Challenge challenge = _challengesCopy.remove(UtilMath.r(_challengesCopy.size()))
.getConstructor(MineWare.class).newInstance(this);
Challenge challenge = _challengesCopy.get(UtilMath.r(_challengesCopy.size())).getConstructor(MineWare.class).newInstance(this);
if (getChallengers().size() >= challenge.getMinPlayers())
{
if (getChallengers().size() >= challenge.getMaxPlayers())
{
System.out.print(
"Cannot use challenge " + challenge.getClass().getSimpleName() + ", too many players");
Bukkit.broadcastMessage("Cannot use challenge " + challenge.getClass().getSimpleName() + ", too many players");
continue;
}
if (challenge.getTeamBased() == true)
{
if (!(getChallengers().size() % 2 == 0))
{
System.out.print("Cannot use Challege: " + challenge.getClass().getSimpleName()
+ ". The game is a teamgame with unequal amount of living players");
Bukkit.broadcastMessage("Cannot use Challege: " + challenge.getClass().getSimpleName()+ ". The game is a teamgame with unequal amount of living players");
continue;
}
}
System.out.print("Using challenge " + challenge.getClass().getSimpleName());
Bukkit.broadcastMessage("Using challenge " + challenge.getClass().getSimpleName());
_challengesCopy.remove(challenge.getClass());
return challenge;
}
else
{
System.out.print(
"Cannot use challenge " + challenge.getClass().getSimpleName() + ", not enough players");
Bukkit.broadcastMessage("Cannot use challenge " + challenge.getClass().getSimpleName() + ", not enough players");
continue;
}
}
catch (InvocationTargetException ex)
@ -450,6 +471,10 @@ public class MineWare extends SoloGame implements IThrown
public void onQuit(PlayerQuitEvent event)
{
_lives.remove(event.getPlayer());
if(_places.contains(event.getPlayer()))
{
_places.remove(event.getPlayer());
}
if (_challenge != null)
{
@ -575,9 +600,16 @@ public class MineWare extends SoloGame implements IThrown
if (_challenge == null)
{
System.out.println("No challenge suitable");
SetState(GameState.Dead);
return;
Bukkit.broadcastMessage(C.cRed + "No challenge suitable! " + _challengesCopy.size() + " challenges were left!");
_challengesCopy.clear();
_challengesCopy.addAll(_challenges);
_challenge = GetOrder();
if (_challenge == null) // If the challenge is still null = Morten is poop at coding...
{
SetState(GameState.Dead);
return;
}
}
for (Block block : _lastOrderBlocks)
@ -828,6 +860,15 @@ public class MineWare extends SoloGame implements IThrown
return;
int lives = GetLives(player);
int playersAlive = 0;
for(Player players: _lives.keySet())
{
if(_lives.get(players) > 0)
{
playersAlive++;
}
}
lives -= 1;
_lives.put(player, lives);
@ -838,8 +879,11 @@ public class MineWare extends SoloGame implements IThrown
}
else
{
if(playersAlive <= 3)
{
_places.add(player);
}
gameLostMessage(player);
Scoreboard.ResetScore(player.getName());
SetPlayerState(player, PlayerState.OUT);
@ -863,6 +907,10 @@ public class MineWare extends SoloGame implements IThrown
{
LoseLife(player, true);
}
if(_challenge.IsCompleted(player))
{
AddGems(player, 3, "Completed Challenge", true, true);
}
}
// Deregister
@ -912,12 +960,12 @@ public class MineWare extends SoloGame implements IThrown
}
if (_challenge != null && _isChallengeStarted)
{
Scoreboard.Write(C.cRed + "Players Currently completed");
Scoreboard.Write("" + _challenge.Completed.size());
Scoreboard.Write(C.cGreen + "Players Currently Alive");
Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + "Players Currently Out");
Scoreboard.Write("" + _challenge.Lost.size());
Scoreboard.WriteBlank();
}
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + "Players In");

View File

@ -51,6 +51,7 @@ public class ChallengeAnvilDance extends Challenge
// The amount of anvils that have yet to land in the platform or are launched in air.
private HashSet<FallingBlock> _fallingAnvils = new HashSet<FallingBlock>();
private long killCurrentTime;
private BukkitTask _fireworkTask;
@ -215,6 +216,7 @@ public class ChallengeAnvilDance extends Challenge
}
_paused = true;
killCurrentTime = System.currentTimeMillis()+3000;
playFireworksTask();
for(Player player : UtilServer.getPlayers())
@ -339,6 +341,10 @@ public class ChallengeAnvilDance extends Challenge
cancel();
return;
}
if(killCurrentTime > System.currentTimeMillis())
{
return;
}
for(Entity entity : block.getNearbyEntities(0.05, 0.05, 0.05))
{
@ -348,6 +354,8 @@ public class ChallengeAnvilDance extends Challenge
if(isDone(player))
return;
if(!Host.IsAlive(player))
return;
player.damage(player.getHealth());
cancel();

View File

@ -52,9 +52,9 @@ public class ChallengeDogvsCat extends Challenge
{
ArrayList<Location> spawns = new ArrayList<Location>();
for(int x = -(getArenaSize() - 1); x <= getArenaSize(); x++)
for(int x = -(getArenaSize() - 1); x <= getArenaSize()-1; x++)
{
for(int z = -(getArenaSize() - 1); z <= getArenaSize(); z++)
for(int z = -(getArenaSize() - 1); z <= getArenaSize()-1; z++)
{
if(x % 2 == 0 && z % 2 == 0)
{
@ -187,8 +187,8 @@ public class ChallengeDogvsCat extends Challenge
int dogScore = calculateScore("dog");
UtilTextMiddle.display(C.cBlue + C.Bold + "Dogs: " + C.cGreen + _dogScore + "/" + dogScore + " - " + C.cRed + C.Bold
+ "Cats: " + C.cGreen + _catScore + "/" + catScore, "");
UtilTextMiddle.display("", C.cBlue + C.Bold + " Dogs: " + C.cGreen + _dogScore + "/" + dogScore + C.cGray + " - " + C.cRed + C.Bold
+ "Cats: " + C.cGreen + _catScore + "/" + catScore);
if(_catScore >= catScore)
{

View File

@ -321,6 +321,8 @@ public class ChallengeFallingBlocks extends Challenge
if(isDone(player))
return;
if(!Host.IsAlive(player))
return;
player.damage(player.getHealth());
cancel();

View File

@ -57,7 +57,7 @@ public class ChallengeKOTL extends Challenge
@Override
public int getMaxPlayers()
{
return 10;
return 15;
}
@Override

View File

@ -136,7 +136,7 @@ public class ChallengeKangarooJump extends Challenge
_players.put(player.getName(), false);
}
@EventHandler
@EventHandler
public void playerJumpTracker(PlayerMoveEvent event)
{
if(!Host.IsLive())
@ -146,7 +146,7 @@ public class ChallengeKangarooJump extends Challenge
Player player = event.getPlayer();
if(player.getLocation().getBlockY() < 4)
{
return;
return; // Return = Stop code
}
if(!player.isOnGround())
{

View File

@ -47,7 +47,8 @@ public class ChallengeMinecartDance extends Challenge
public ChallengeMinecartDance(MineWare host)
{
super(host, ChallengeType.LastStanding, "Minecart Dance", "Get ready when the fireworks change color.", "Once they're green, get inside a minecart!");
super(host, ChallengeType.LastStanding, "Musical Minecart", "Get ready when the fireworks change color.",
"Once they're green, get inside a minecart!");
}
@Override
@ -55,11 +56,11 @@ public class ChallengeMinecartDance extends Challenge
{
ArrayList<Location> spawns = new ArrayList<Location>();
for(int x = -(getArenaSize(7) - 1); x <= getArenaSize(7); x++)
for (int x = -(getArenaSize(7) - 1); x <= getArenaSize(7); x++)
{
for(int z = -(getArenaSize(7) - 1); z <= getArenaSize(7); z++)
for (int z = -(getArenaSize(7) - 1); z <= getArenaSize(7); z++)
{
if(x % 2 == 0 && z % 2 == 0)
if (x % 2 == 0 && z % 2 == 0)
{
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
}
@ -71,15 +72,17 @@ public class ChallengeMinecartDance extends Challenge
@Override
public void cleanupRoom()
{
if(_isPlayingMusic)
if (_isPlayingMusic)
{
_isPlayingMusic = false;
for(Player player: UtilServer.getPlayers())
for (Player player : UtilServer.getPlayers())
{
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005, new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY()+5, getCenter().getBlockZ()), 0, false));
((CraftPlayer) player).getHandle().playerConnection
.sendPacket(new PacketPlayOutWorldEvent(1005, new BlockPosition(getCenter().getBlockX(),
getCenter().getBlockY() + 5, getCenter().getBlockZ()), 0, false));
}
}
for(Minecart minecarts : _minecarts)
for (Minecart minecarts : _minecarts)
{
minecarts.remove();
}
@ -96,28 +99,28 @@ public class ChallengeMinecartDance extends Challenge
@Override
public void generateRoom()
{
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
{
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
{
for(int y = 0; y <= 1; y++)
for (int y = 0; y <= 1; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
if(y == 0)
if (y == 0)
{
b.setType(Material.WOOL);
b.setData((byte) UtilMath.r(16));
}
else
{
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
{
b.setType(Material.FENCE);
}
}
if(b.getType() != Material.AIR)
if (b.getType() != Material.AIR)
{
addBlock(b);
}
@ -129,20 +132,20 @@ public class ChallengeMinecartDance extends Challenge
@EventHandler
public void gameChecker(UpdateEvent event)
{
if(event.getType() != UpdateType.FASTEST)
if (event.getType() != UpdateType.FASTEST)
{
return;
}
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(_state == 3)
if (_state == 3)
{
_availableMinecarts = 0;
for(Minecart mc : _minecarts)
for (Minecart mc : _minecarts)
{
if(!mc.isEmpty())
if (!mc.isEmpty())
{
continue;
}
@ -151,11 +154,11 @@ public class ChallengeMinecartDance extends Challenge
_availableMinecarts++;
}
}
if(_availableMinecarts == 0)
if (_availableMinecarts == 0)
{
for(Player player : getCurrentyAlive(true))
for (Player player : getCurrentyAlive(true))
{
if(!player.isInsideVehicle())
if (!player.isInsideVehicle())
{
Host.WorldData.World.strikeLightningEffect(player.getLocation());
setLost(player);
@ -166,9 +169,9 @@ public class ChallengeMinecartDance extends Challenge
_timeSinceLastState = System.currentTimeMillis();
_state = 1;
for(Minecart minecarts : _minecarts)
for (Minecart minecarts : _minecarts)
{
if(!minecarts.isEmpty())
if (!minecarts.isEmpty())
{
minecarts.eject();
}
@ -184,28 +187,30 @@ public class ChallengeMinecartDance extends Challenge
{
// Main event that's fired each sec
if(event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.SEC)
{
return;
}
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(_state == 1) // waiting
if (_state == 1) // waiting
{
if(!_isPlayingMusic)
if (!_isPlayingMusic)
{
_isPlayingMusic = true;
for(Player player: UtilServer.getPlayers())
for (Player player : UtilServer.getPlayers())
{
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005, new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY()+5, getCenter().getBlockZ()), 2259, false));
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005,
new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY() + 5, getCenter()
.getBlockZ()), 2259, false));
}
}
if(_timeSinceLastState + 5500 < System.currentTimeMillis())
if (_timeSinceLastState + 5500 < System.currentTimeMillis())
{
if(UtilMath.r(4) == 0)
if (UtilMath.r(4) == 0)
{
_state = 2;
}
@ -219,7 +224,7 @@ public class ChallengeMinecartDance extends Challenge
spawnFireworkAtCorners(Color.RED);
}
}
if(_state == 2) // stateChange
if (_state == 2) // stateChange
{
new BukkitRunnable()
{
@ -227,33 +232,45 @@ public class ChallengeMinecartDance extends Challenge
@Override
public void run()
{
for(int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
{
spawnFireworkAtCorners(Color.GREEN);
//Thread.sleep((500)); // 10th tick, causing lag
// Thread.sleep((500)); // 10th tick, causing lag
}
}
}.runTaskLater(Host.Manager.getPlugin(), 0);
if(_isPlayingMusic)
if (_isPlayingMusic)
{
_isPlayingMusic = false;
for(Player player: UtilServer.getPlayers())
for (Player player : UtilServer.getPlayers())
{
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005, new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY()+5, getCenter().getBlockZ()), 0, false));
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005,
new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY() + 5, getCenter()
.getBlockZ()), 0, false));
}
}
for(int i = 0; i < getCurrentyAlive(true).size()*0.66; i++)
for (int i = 0; i < getCurrentyAlive(true).size() / 2; i++)
{
Minecart minecart = Host.WorldData.World.spawn(new Location(Host.WorldData.World,
UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7)), 2, UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7))), Minecart.class);
Minecart minecart = Host.WorldData.World.spawn(
new Location(Host.WorldData.World, UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7)), 2,
UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7))), Minecart.class);
UtilEnt.ghost(minecart, true, false);
_minecarts.add(minecart);
}
_state = 3;
if(getCurrentyAlive(false).size() >= 10)
{
startTimer(Math.round(getCurrentyAlive(false).size()/2.5));
}
else
{
startTimer(Math.round(4));
}
}
else if(_state == 3)
else if (_state == 3)
{
new BukkitRunnable()
{
@ -261,14 +278,14 @@ public class ChallengeMinecartDance extends Challenge
@Override
public void run()
{
if(_state != 3 || !Host.IsLive())
if (_state != 3 || !Host.IsLive())
{
this.cancel();
}
int minecarts = 0;
for(Minecart minecart : _minecarts)
for (Minecart minecart : _minecarts)
{
if(!minecart.isEmpty())
if (!minecart.isEmpty())
{
minecarts++;
}
@ -283,43 +300,86 @@ public class ChallengeMinecartDance extends Challenge
@EventHandler
public void onVehicleDamage(VehicleDamageEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(event.getVehicle() instanceof Minecart)
{
event.setCancelled(true);
}
}
@EventHandler
public void onVehicleInteract(VehicleEnterEvent event)
{
if(!Host.IsLive())
{
return;
}
if(!(event.getEntered() instanceof Player))
{
return;
}
Player player = (Player) event.getEntered();
if(isLost(player) || !Host.IsPlaying(player))
if (event.getVehicle() instanceof Minecart)
{
event.setCancelled(true);
}
}
@EventHandler
public void onVehicleInteract(VehicleEnterEvent event)
{
if (!Host.IsLive())
{
return;
}
if (!(event.getEntered() instanceof Player))
{
return;
}
Player player = (Player) event.getEntered();
if (isLost(player) || !Host.IsPlaying(player))
{
event.setCancelled(true);
}
}
public void startTimer(long ticks)
{
new BukkitRunnable()
{
@Override
public void run()
{
if (_state == 3)
{
for (Player player : getCurrentyAlive(true))
{
if (!player.isInsideVehicle())
{
Host.WorldData.World.strikeLightningEffect(player.getLocation());
setLost(player);
UtilPlayer.message(player, F.main("Minecart Dance", "You didn't make it inside a Minecart in time!"));
}
}
_timeSinceLastState = System.currentTimeMillis();
_state = 1;
for (Minecart minecarts : _minecarts)
{
if (!minecarts.isEmpty())
{
minecarts.eject();
}
minecarts.remove();
}
_minecarts.clear();
}
else
{
this.cancel();
}
}
}.runTaskLater(Host.Manager.getPlugin(), ticks);
}
public void spawnFireworkAtCorners(Color color)
{
UtilFirework.playFirework(new Location(Host.WorldData.World, getArenaSize() + 5, 10, getArenaSize() + 5), Type.BALL_LARGE, color, false,
false);
UtilFirework.playFirework(new Location(Host.WorldData.World, -getArenaSize() - 5, 10, getArenaSize() + 5), Type.BALL_LARGE, color, false,
false);
UtilFirework.playFirework(new Location(Host.WorldData.World, getArenaSize() + 5, 10, -getArenaSize() - 5), Type.BALL_LARGE, color, false,
false);
UtilFirework.playFirework(new Location(Host.WorldData.World, -getArenaSize() - 5, 10, -getArenaSize() - 5), Type.BALL_LARGE, color, false,
false);
UtilFirework.playFirework(new Location(Host.WorldData.World, getArenaSize() + 5, 10, getArenaSize() + 5),
Type.BALL_LARGE, color, false, false);
UtilFirework.playFirework(new Location(Host.WorldData.World, -getArenaSize() - 5, 10, getArenaSize() + 5),
Type.BALL_LARGE, color, false, false);
UtilFirework.playFirework(new Location(Host.WorldData.World, getArenaSize() + 5, 10, -getArenaSize() - 5),
Type.BALL_LARGE, color, false, false);
UtilFirework.playFirework(new Location(Host.WorldData.World, -getArenaSize() - 5, 10, -getArenaSize() - 5),
Type.BALL_LARGE, color, false, false);
}
}

View File

@ -21,7 +21,7 @@ public class ChallengeNavigateMaze extends Challenge
private HashMap<Player, Long> _playerCompletionTime = new HashMap<Player, Long>();
public ChallengeNavigateMaze(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze.");
super(host, ChallengeType.FirstComplete, "Nagivation Maze", "Go to the other side of the maze.");
}
@Override

View File

@ -6,8 +6,6 @@ import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -21,8 +19,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import com.sun.xml.internal.ws.resources.UtilMessages;
public class ChallengePickASide extends Challenge
{
private int _time = 8;
@ -32,7 +28,7 @@ public class ChallengePickASide extends Challenge
public ChallengePickASide(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the least players wins!");
super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the fewest players wins!", "No... Standing in the middle won't work");
}
public int getMinPlayers()

View File

@ -39,6 +39,7 @@ public class ChallengeRedLightGreenLight extends Challenge
private boolean _canMove;
private int _minTimeBeforeGreen = 2500;
private int _minTimeBeforeRed = 1500;
private int _villagerLocationX = 30;
private long _timeBeforeAction;
private long _timeSinceLastGreen;
private long _timeSinceLastRed;
@ -119,6 +120,10 @@ public class ChallengeRedLightGreenLight extends Challenge
b.setType(Material.WOOL);
b.setData(_colorList.get(colorPicker).byteValue());
}
if(x == _villagerLocationX)
{
b.setType(Material.COAL_BLOCK);
}
if(b.getType() != Material.AIR)
{
addBlock(b);
@ -133,7 +138,7 @@ public class ChallengeRedLightGreenLight extends Challenge
}
Host.CreatureAllowOverride = true;
_host = (Villager)getCenter().getWorld().spawnEntity(new Location(getCenter().getWorld(), 30, 1, 0), EntityType.VILLAGER);
_host = (Villager)getCenter().getWorld().spawnEntity(new Location(getCenter().getWorld(), _villagerLocationX, 2, 0), EntityType.VILLAGER);
UtilEnt.Vegetate(_host);
UtilEnt.ghost(_host, true, false);
Host.CreatureAllowOverride = false;
@ -150,7 +155,7 @@ public class ChallengeRedLightGreenLight extends Challenge
{
return;
}
if(event.getPlayer().getLocation().getX() > 30) // Wins the challenge
if(event.getPlayer().getLocation().getX() > _villagerLocationX) // Wins the challenge
{
SetCompleted(event.getPlayer());
}

View File

@ -3,6 +3,8 @@ package nautilus.game.arcade.game.games.mineware.challenges;
import java.util.ArrayList;
import java.util.HashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
@ -16,16 +18,19 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
public class ChallengeRushPush extends Challenge
{
private boolean _challengeEnded = false;
private HashMap<String, String> _teams = new HashMap<String, String>();
public ChallengeRushPush(MineWare host)
{
super(host, ChallengeType.LastStanding, "Rush push", true, true, "Rush to your enemy.", "Push them off the platform.", "Remember you have no teammates!");
super(host, ChallengeType.LastStanding, "Rush push", true, true, "Rush to your enemy.",
"Push them off the platform.");
}
@Override
@ -33,11 +38,11 @@ public class ChallengeRushPush extends Challenge
{
ArrayList<Location> locations = new ArrayList<Location>();
for(int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++)
for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++)
{
for(int z = -6; z <= 6; z += 6)
for (int z = -6; z <= 6; z += 6)
{
if(z == 0)
if (z == 0)
continue;
locations.add(getCenter().add(x + 0.5, 1.1, z + 0.5));
@ -56,9 +61,9 @@ public class ChallengeRushPush extends Challenge
@Override
public void setupPlayers()
{
for(Player player : Host.GetPlayers(true))
for (Player player : Host.GetPlayers(true))
{
if(player.getLocation().add(0, -1, 0).getBlock().getData() == (byte) 11)
if (player.getLocation().add(0, -1, 0).getBlock().getData() == (byte) 11)
{
_teams.put(player.getName(), "blue");
}
@ -69,7 +74,7 @@ public class ChallengeRushPush extends Challenge
player.getInventory().addItem(new ItemStack(Material.DIAMOND_SWORD));
}
for(String playerNames : _teams.keySet())
for (String playerNames : _teams.keySet())
{
Player thePlayer = Bukkit.getPlayer(playerNames);
@ -87,16 +92,16 @@ public class ChallengeRushPush extends Challenge
@Override
public void generateRoom()
{
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
{
for(int z = -6; z <= 6; z++)
for (int z = -6; z <= 6; z++)
{
for(int y = 0; y <= 0; y++)
for (int y = 0; y <= 0; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
b.setType(Material.STAINED_CLAY);
if(z != 0)
if (z != 0)
{
b.setData((byte) (z < 0 ? 11 : z > 0 ? 14 : 0));
}
@ -105,23 +110,64 @@ public class ChallengeRushPush extends Challenge
}
}
}
@EventHandler
public void onDeath(PlayerDeathEvent event)
{
int onBlue = 0;
int onRed = 0;
if(_teams.containsKey(event.getEntity().getName()))
{
_teams.remove(event.getEntity().getName());
}
for(String playerName: _teams.keySet())
{
if(_teams.get(playerName) == "blue")
{
onBlue++;
}
else
{
onRed++;
}
}
if((onBlue == 0 || onRed == 0) && Host._currentCrumble == false)
{
UtilTextMiddle.display(onBlue == 0 ? C.cBlue + "Blue Team won!" : C.cRed + "Red Team won!", "Friendly fire enabled!", 20, 60, 20);
}
}
@EventHandler
public void onPlayerDamage(CustomDamageEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(!(event.GetDamagerPlayer(true) instanceof Player) || !(event.GetDamageeEntity() instanceof Player))
if (!(event.GetDamagerPlayer(true) instanceof Player) || !(event.GetDamageeEntity() instanceof Player))
{
return;
}
if(isLost(event.GetDamagerPlayer(false)))
if (isLost(event.GetDamagerPlayer(false)))
{
event.SetCancelled("Player out of the game");
return;
}
if (!Host._currentCrumble)
{
if (_teams.containsKey(event.GetDamagerPlayer(false).getName()))
{
if (_teams.containsKey(event.GetDamageePlayer().getName()))
{
if (_teams.get(event.GetDamagerPlayer(false).getName()) == _teams.get(event.GetDamageePlayer()
.getName()))
{
event.SetCancelled("Friendly Fire");
return;
}
}
}
}
event.AddMult("Ignore damage", null, 0.001, false);
event.AddKnockback("Power Punch", 5.5);
}

View File

@ -131,8 +131,21 @@ public class ChallengeShootChickens extends Challenge
{
return;
}
UpdateType speed;
if(getCurrentyAlive(false).size() >= 40)
{
speed = UpdateType.FASTEST;
}
else if(getCurrentyAlive(false).size() >= 20)
{
speed = UpdateType.FASTER;
}
else
{
speed = UpdateType.FAST;
}
if (event.getType() != UpdateType.FAST)
if (event.getType() != speed)
{
return;
}

View File

@ -112,7 +112,7 @@ public class ChallengeVolleyPig extends Challenge
@Override
public int getMaxPlayers()
{
return 20;
return 25;
}
@EventHandler(priority = EventPriority.LOW)

View File

@ -189,6 +189,10 @@ public class ChallengeWaveCrush extends Challenge
{
return;
}
if(!Host.IsAlive(thePlayer))
{
return;
}
Host.Manager.GetDamage().NewDamageEvent(target, null, null, DamageCause.PROJECTILE, 9999.0, false, false, false, "Falling Block",
"Wave crush");
}

View File

@ -77,6 +77,7 @@ public class PerkCowAngryHerd extends SmashPerk
for (double i=-2 ; i<3 ; i++)
{
Cow cow;
Vector dir = player.getLocation().getDirection();
dir.setY(0);
dir.normalize();
@ -87,11 +88,19 @@ public class PerkCowAngryHerd extends SmashPerk
loc.add(UtilAlg.getLeft(dir).multiply(i*1.5));
Manager.GetGame().CreatureAllowOverride = true;
if(isSuperActive(player))
{
cow = player.getWorld().spawn(loc, MushroomCow.class);
}
else
{
cow = player.getWorld().spawn(loc, Cow.class);
}
Class<? extends Cow> clazz = isSuperActive(player) ? MushroomCow.class : Cow.class;
Cow cow = player.getWorld().spawn(loc, clazz);
Cow cow1 = player.getWorld().spawn(loc, clazz);
Manager.GetGame().CreatureAllowOverride = false;
_active.add(new DataCowCharge(player, cow));
_active.add(new DataCowCharge(player, cow1));
}
//Sound

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RemoteSystemsTempFiles</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
</natures>
</projectDescription>