Commit before updating morten's branch

This commit is contained in:
Thanos paravantis 2015-12-12 10:12:42 +02:00
commit 246b67f5a0
16 changed files with 187 additions and 46 deletions

1
.gitignore vendored
View File

@ -51,3 +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
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mineplex.Cache</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mineplex.Game.Clans.Core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -28,6 +28,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitRunnable;
public abstract class Challenge implements Listener
@ -43,7 +44,7 @@ public abstract class Challenge implements Listener
protected long Duration;
protected HashSet<Player> Completed = new HashSet<Player>();
protected HashSet<Player> Lost = new HashSet<Player>();
protected HashSet<Player> currentPlaying;
protected HashSet<Player> CurrentPlaying;
private boolean _teamBased;
private boolean _crumble;
@ -80,6 +81,17 @@ public abstract class Challenge implements Listener
setBorder(-100, 100, 0, 256, -100, 100);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
if(!Host.IsLive())
{
return;
}
removePlayerFromAllLists(event.getPlayer());
}
public long getMaxTime()
{
return 60000;
@ -119,7 +131,7 @@ public abstract class Challenge implements Listener
public void StartOrder()
{
currentPlaying = new HashSet<Player>(getChallengers());
CurrentPlaying = new HashSet<Player>(getChallengers());
setupPlayers();
Completed.clear();
@ -352,7 +364,7 @@ public abstract class Challenge implements Listener
public ArrayList<Player> getCurrentyAlive(boolean ignoreAlreadyWon)
{
ArrayList<Player> currentlyAlive = new ArrayList<Player>();
for(Player player: currentPlaying)
for(Player player: CurrentPlaying)
{
if(isLost(player))
{
@ -396,6 +408,26 @@ public abstract class Challenge implements Listener
return false;
}
public void removePlayerFromAllLists(Player player)
{
if(Lost.contains(player))
{
Lost.remove(player);
}
if(Completed.contains(player))
{
Completed.remove(player);
}
if(_invisPlayers.contains(player))
{
_invisPlayers.remove(player);
}
if(CurrentPlaying.contains(player))
{
CurrentPlaying.remove(player);
}
}
public String getChallengeName()
{
return _challengeName;

View File

@ -37,6 +37,7 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeArrowRampage
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockLobbers;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockRunner;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBouncingBlock;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBuildRace;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeChestLoot;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeCloudFall;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDogvsCat;
@ -113,6 +114,7 @@ public class MineWare extends SoloGame implements IThrown
private ArrayList<Class<? extends Challenge>> _challenges = new ArrayList<Class<? extends Challenge>>();
private ArrayList<Class<? extends Challenge>> _challengesCopy = new ArrayList<Class<? extends Challenge>>();
@SuppressWarnings("unchecked")
public MineWare(ArcadeManager manager)
{
super(manager, GameType.MineWare,
@ -224,7 +226,7 @@ public class MineWare extends SoloGame implements IThrown
_challenges.add(ChallengeCloudFall.class);
_challenges.add(ChallengeInfestation.class);
_challenges.add(ChallengeBouncingBlock.class);
_challenges.add(ChallengeBlockRunner.class);
_challenges.add(ChallengeBuildRace.class);
_challenges.add(ChallengeFastFood.class);
_challenges.add(ChallengeMinecartDance.class);
_challenges.add(ChallengeRedLightGreenLight.class);
@ -432,6 +434,11 @@ public class MineWare extends SoloGame implements IThrown
public void onQuit(PlayerQuitEvent event)
{
_lives.remove(event.getPlayer());
if(_challenge != null)
{
_challenge.CurrentPlaying.remove(event.getPlayer());
}
}
public ArrayList<Player> getChallengers()
@ -675,7 +682,7 @@ public class MineWare extends SoloGame implements IThrown
{
if(_challenge.getCrumble() && !_challenge.getModifiedBlocks().isEmpty())
{
if(_currentCrumble == false && _challenge.Lost.size() >= _challenge.currentPlaying.size() / 2)
if(_currentCrumble == false && _challenge.Lost.size() >= _challenge.CurrentPlaying.size() / 2)
{
_currentCrumble = true;
for(Player player : UtilServer.getPlayers())
@ -689,7 +696,7 @@ public class MineWare extends SoloGame implements IThrown
}
else
{
if((_challenge.currentPlaying.size() - _challenge.Lost.size()) <= 1 && _currentCrumble)
if((_challenge.CurrentPlaying.size() - _challenge.Lost.size()) <= 1 && _currentCrumble)
{
endCurrentChallenge();
_currentCrumble = false;
@ -743,7 +750,7 @@ public class MineWare extends SoloGame implements IThrown
{
return;
}
if(event.getMessage().equalsIgnoreCase("/tp") || event.getMessage().equalsIgnoreCase("/teleport"))
if(event.getMessage().contains("/tp") || event.getMessage().contains("/teleport"))
{
CoreClient staff = getArcadeManager().GetClients().Get(event.getPlayer());
@ -758,7 +765,6 @@ public class MineWare extends SoloGame implements IThrown
Manager.addSpectator(player, true);
}
}
}
@ -850,7 +856,7 @@ public class MineWare extends SoloGame implements IThrown
}
Scoreboard.Reset();
if(GetPlayers(false).size() > 14)
if(GetPlayers(true).size() > 14)
{
int alive = 0;
for(Player cAlive : _lives.keySet())
@ -860,17 +866,26 @@ public class MineWare extends SoloGame implements IThrown
alive++;
}
}
if(_challenge != null && _isChallengeStarted)
{
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 Alive");
Scoreboard.Write(C.cGreen + "Players In");
Scoreboard.Write(alive + " ");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + "Players out: ");
Scoreboard.Write(C.cRed + "Players Out");
Scoreboard.Write((GetPlayers(false).size() - alive) + " ");
}
else
{
Scoreboard.WriteBlank();
for(Player player : GetPlayers(false))
for(Player player : GetPlayers(true))
{
int currentLives = GetLives(player);

View File

@ -4,13 +4,6 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilShapes;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
@ -26,8 +19,16 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilShapes;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
public class ChallengeAnvilDance extends Challenge
{
// The amount of seconds until the anvils start to dance.
@ -50,6 +51,8 @@ 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 BukkitTask _fireworkTask;
public ChallengeAnvilDance(MineWare host)
{
@ -105,6 +108,7 @@ public class ChallengeAnvilDance extends Challenge
@Override
public void cleanupRoom()
{
_fireworkTask.cancel();
_paused = false;
for(Block block : _landedAnvils)
@ -289,7 +293,7 @@ public class ChallengeAnvilDance extends Challenge
private void playFireworksTask()
{
new BukkitRunnable()
_fireworkTask = new BukkitRunnable()
{
int height = _fireworkHeight;
int times = 0;

View File

@ -215,7 +215,7 @@ public class ChallengeBouncingBlock extends Challenge
if(b.getType() == Material.AIR || b.getType() == null)
{
if(UtilMath.r(200) == 50)
if(UtilMath.r(50) == 0)
{
Byte color = (byte) UtilMath.r(16);
while(color == 14)

View File

@ -173,7 +173,7 @@ public class ChallengeDogvsCat extends Challenge
@EventHandler
public void checkForWinner(UpdateEvent event)
{
if(event.getType() != UpdateType.FASTEST)
if(event.getType() != UpdateType.TICK)
{
return;
}
@ -187,8 +187,8 @@ public class ChallengeDogvsCat extends Challenge
int dogScore = calculateScore("dog");
UtilTextMiddle.display(C.cBlue + C.Bold + "Dog's: " + C.cGreen + _dogScore + "/" + dogScore + " - " + C.cRed + C.Bold
+ "Cat's: " + C.cGreen + _catScore + "/" + catScore, "");
UtilTextMiddle.display(C.cBlue + C.Bold + "Dogs: " + C.cGreen + _dogScore + "/" + dogScore + " - " + C.cRed + C.Bold
+ "Cats: " + C.cGreen + _catScore + "/" + catScore, "");
if(_catScore >= catScore)
{

View File

@ -125,7 +125,7 @@ public class ChallengeFishingDay extends Challenge
}
else
{
if(y == 5)
if(y == 5 && !getSpawns().contains(block.getLocation()))
{
block.setType(Material.GRASS);
@ -379,12 +379,15 @@ public class ChallengeFishingDay extends Challenge
// Check if the player is retracting the hook.
// Once hook is retracted, the entity is valid but not on ground.
return _fishing.get(fisher) && hook.isValid() && !hook.isOnGround();
Location droppedHook = hook.getLocation();
Block below = droppedHook.getBlock().getRelative(BlockFace.DOWN);
return _fishing.get(fisher) && hook.isValid() && !hook.isOnGround() && below.getType() == Material.STATIONARY_WATER;
}
private void createExplosion(Player target, Location dropsite)
{
if (Recharge.Instance.use(target, "TNT Spawn", 700, false, false))
if(Recharge.Instance.use(target, "TNT Spawn", 700, false, false))
{
World world = dropsite.getWorld();

View File

@ -8,6 +8,10 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.Hologram.HologramTarget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
@ -33,6 +37,7 @@ public class ChallengeMilkACow extends Challenge
private Villager _villager;
private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>();
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
private HashMap<Entity, Hologram> _cowIndicator = new HashMap<Entity, Hologram>();
public ChallengeMilkACow(MineWare host)
{
@ -44,9 +49,11 @@ public class ChallengeMilkACow extends Challenge
{
for (Entity cow : _milked.keySet())
{
Hologram holo = _cowIndicator.get(cow);
holo.stop();
cow.remove();
}
_villager.remove();
}
@ -72,8 +79,6 @@ public class ChallengeMilkACow extends Challenge
@Override
public void setupPlayers()
{
setBorder(-16, 16, 0, 10, -16, 16);
for (Player player : Host.GetPlayers(true))
{
DisguiseVillager disguise = new DisguiseVillager(player);
@ -135,7 +140,7 @@ public class ChallengeMilkACow extends Challenge
String[] names = new String[]
{
"Tom", "Steve", "John", "Harry", "Andrew", "Daniel", "Jorge", "Jim"
"Tom", "Steve", "John", "Harry", "Andrew", "Daniel", "Bobbae", "Jim"
};
if (UtilMath.r(5) == 0)
@ -155,11 +160,42 @@ public class ChallengeMilkACow extends Challenge
cow.setCustomNameVisible(true);
_milked.put(cow, new ArrayList<String>());
_cowIndicator.put(cow, new Hologram(Host.Manager.getHologramManager(), cow.getLocation().clone().add(0, 2.5, 0), C.cRed + "Already Milked!"));
Hologram holo = _cowIndicator.get(cow);
holo.setHologramTarget(HologramTarget.WHITELIST);
holo.setFollowEntity(cow);
holo.start();
}
Host.CreatureAllowOverride = false;
}
@EventHandler
public void cowIndicator(UpdateEvent event)
{
if(!Host.IsLive())
{
return;
}
if(event.getType() != UpdateType.SEC)
{
return;
}
for(Entity entCow: _milked.keySet())
{
for(String playerName: _milked.get(entCow))
{
Hologram holo = _cowIndicator.get(entCow);
if(!holo.containsPlayer(playerName))
{
holo.addPlayer(playerName);
}
}
}
}
@EventHandler
public void onEntityInteract(PlayerInteractEntityEvent event)
{
@ -190,6 +226,7 @@ public class ChallengeMilkACow extends Challenge
{
p.setItemInHand(new ItemStack(Material.MILK_BUCKET));
_milked.get(ent).add(p.getName());
Cow cow = (Cow) ent;
}
else
{

View File

@ -244,7 +244,7 @@ public class ChallengeMinecartDance extends Challenge
}
}
for(int i = 0; i < getCurrentyAlive(true).size() - 1; i++)
for(int i = 0; i < getCurrentyAlive(true).size()*0.66; 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);

View File

@ -207,24 +207,13 @@ public class ChallengeReverseTag extends Challenge
}
}
private void removeTagged(final Player player)
private void removeTagged(Player player)
{
if(_tagged.contains(player.getName()))
{
UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!");
player.getInventory().setHelmet(new ItemStack(Material.AIR));
_tagged.remove(player.getName());
_cooldowned.add(player.getName());
new BukkitRunnable()
{
@Override
public void run()
{
_cooldowned.remove(player.getName());
}
}.runTaskLater(Host.Manager.getPlugin(), 20*_cooldown);
if(_nonTaggedPlayers.contains(player))
{
@ -238,13 +227,25 @@ public class ChallengeReverseTag extends Challenge
}
}
private void addTagged(Player player)
private void addTagged(final Player player)
{
if(!_tagged.contains(player.getName()))
{
UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cGreen + "NOW" + C.cYellow + " tagged! Keep it up!");
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(35, (byte) 5));
_tagged.add(player.getName());
_cooldowned.add(player.getName());
new BukkitRunnable()
{
@Override
public void run()
{
_cooldowned.remove(player.getName());
}
}.runTaskLater(Host.Manager.getPlugin(), 20*_cooldown);
for(int i = 0; i <= 8; i++)
{

View File

@ -257,7 +257,7 @@ public class ChallengeWaveCrush extends Challenge
FallingBlock fBlock = Host.WorldData.World.spawnFallingBlock(theBlock.getLocation().clone().add(0, 1, 0), theBlock.getType(),
theBlock.getData());
Host.Manager.GetProjectile().AddThrow(fBlock, null, Host, -1, true, false, true, true, 0.4f);
Host.Manager.GetProjectile().AddThrow(fBlock, null, Host, -1, true, false, true, true, 0.7f);
fBlock.setVelocity(new Vector(0, 10, 0).normalize());
theBlock.setType(Material.AIR);
theBlock = Host.WorldData.World.getBlockAt(theBlock.getX() - 1, theBlock.getY(), theBlock.getZ());

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>