Merge remote-tracking branch 'remotes/origin/master' into virizion_speed_builder

This commit is contained in:
Virizion 2015-12-08 16:14:41 -05:00
commit 8051486fcb
10 changed files with 78 additions and 75 deletions

View File

@ -28,7 +28,7 @@
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.7" />
<bytecodeTargetLevel target="1.8" />
</component>
<component name="JavacSettings">
<option name="GENERATE_NO_WARNINGS" value="true" />

View File

@ -16,7 +16,7 @@
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,5 +1,7 @@
package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
@ -509,13 +511,21 @@ public class UtilPlayer
if (cur.isDead())
continue;
//Ignore Check
if (ignore != null)
{
for (int i = 0; i < ignore.length; i++)
boolean shouldIgnore = false;
for (Entity ent : ignore)
{
if (cur.equals(ignore[i]))
continue;
if (cur.equals(ent))
{
shouldIgnore = true;
break;
}
}
if (shouldIgnore)
continue;
}
double dist = UtilMath.offset(cur.getLocation(), loc);

View File

@ -1,10 +1,12 @@
package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Stream;
import org.bukkit.Bukkit;
import org.bukkit.Server;
@ -18,6 +20,11 @@ public class UtilServer
return getServer().getOnlinePlayers().toArray(new Player[0]);
}
public static Collection<? extends Player> getPlayersCollection()
{
return getServer().getOnlinePlayers();
}
public static List<Player> getSortedPlayers()
{
return getSortedPlayers(new Comparator<Player>()

View File

@ -1,7 +1,10 @@
package mineplex.core.noteblock;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@ -40,78 +43,57 @@ public class NotePlayer
private void startThread()
{
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
Thread thread = new Thread(() -> {
while (!_finished)
{
long startTime = System.currentTimeMillis();
while (!_finished)
_tick++;
if (_tick > _song.getLength())
{
_tick++;
if (_tick > _song.getLength())
if (_loop)
{
if (_loop)
{
_tick = 1;
}
else
{
_finished = true;
_plugin.getServer().getScheduler().runTask(_plugin, new Runnable()
{
@Override
public void run()
{
SongFinishEvent event = new SongFinishEvent(_song);
_plugin.getServer().getPluginManager().callEvent(event);
}
});
return;
}
_tick = 1;
}
playTick(_tick);
try
else
{
Thread.sleep(_sleepMs);
}
catch (InterruptedException e)
{
e.printStackTrace();
_finished = true;
_plugin.getServer().getScheduler().runTask(_plugin, () -> {
SongFinishEvent event = new SongFinishEvent(_song);
_plugin.getServer().getPluginManager().callEvent(event);
});
return;
}
}
playTick(_tick);
try
{
Thread.sleep(_sleepMs);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
});
thread.start();
}
private void playNote(Note note, float volume, Collection<? extends Player> players)
{
players.stream().filter(_verifier::shouldPlay).forEach((player) ->
player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33)));
}
private void playTick(int tick)
{
Player[] playerArray = UtilServer.getPlayers();
List<Player> players = new ArrayList<>(playerArray.length);
for (Player player : playerArray)
{
if (_verifier.shouldPlay(player))
players.add(player);
}
Collection<? extends Player> players = UtilServer.getPlayersCollection();
for (NoteLayer layer : _song.getLayers())
{
Note note = layer.getNote(tick);
if (note != null)
{
float volume = _volumeMult * (layer.getVolume() / 100F);
for (Player player : players)
{
player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33));
}
}
}
float volume = _volumeMult * 1F;
_song.getLayers().stream().map(layer -> layer.getNote(tick)).filter(Objects::nonNull).forEach((note) -> playNote(note, volume, players));
}
public void cancel()

View File

@ -6,12 +6,11 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.monsterleague.perks.PerkBlinkMonsterLeague;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBlink;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitEnderman extends LeagueKit
@ -28,7 +27,7 @@ public class KitEnderman extends LeagueKit
new Perk[]
{
new PerkDoubleJump("Double Jump", 1, 1, true),
new PerkBlink("Blink", 32, 16000),
new PerkBlinkMonsterLeague("Blink", 32, 16000),
},
EntityType.ENDERMAN,
new ItemStack(Material.AIR), 1.4);

View File

@ -19,14 +19,15 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkBlink extends SmashPerk
public class PerkBlinkMonsterLeague extends Perk
{
private double _range = 32;
private long _recharge = 24000;
public PerkBlink(String name, double range, long recharge)
public PerkBlinkMonsterLeague(String name, double range, long recharge)
{
super("Blink", new String[]
{
@ -51,9 +52,6 @@ public class PerkBlink extends SmashPerk
return;
Player player = event.getPlayer();
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
return;

View File

@ -62,7 +62,7 @@ public class KitPig extends SmashKit
ChatColor.RESET + "dealing damage and knockback to enemies.",
ChatColor.RESET + "",
ChatColor.RESET + "Eat the bacon to restore some Energy.",
ChatColor.RESET + "Bacon that hit an enemy will restore Health.",
ChatColor.RESET + "Bacon that hits an enemy will restore Health.",
}));

View File

@ -87,7 +87,8 @@ public class PerkCowAngryHerd extends SmashPerk
loc.add(UtilAlg.getLeft(dir).multiply(i*1.5));
Manager.GetGame().CreatureAllowOverride = true;
Cow cow = player.getWorld().spawn(loc, isSuperActive(player) ? MushroomCow.class : Cow.class);
Class<? extends Cow> clazz = isSuperActive(player) ? MushroomCow.class : Cow.class;
Cow cow = player.getWorld().spawn(loc, clazz);
Manager.GetGame().CreatureAllowOverride = false;
_active.add(new DataCowCharge(player, cow));

View File

@ -17,11 +17,12 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkBlink extends Perk
public class PerkBlink extends SmashPerk
{
private String _name = "";
private double _range;
@ -45,17 +46,22 @@ public class PerkBlink extends Perk
if (event.isCancelled())
return;
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK &&
event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isAxe(event.getPlayer().getItemInHand()))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (isSuperActive(player))
return;
if (!Recharge.Instance.use(player, _name, _recharge, true, true))
return;