Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ca71f1f64f
@ -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" />
|
||||
|
@ -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>
|
@ -552,8 +552,8 @@ public class UtilBlock
|
||||
if (diagonals)
|
||||
{
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int y = -1; y <= 1; y++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int y = 1; y >= -1; y--)
|
||||
{
|
||||
if (x == 0 && y == 0 && z == 0) continue;
|
||||
|
||||
@ -563,11 +563,11 @@ public class UtilBlock
|
||||
else
|
||||
{
|
||||
blocks.add(block.getRelative(BlockFace.UP));
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
blocks.add(block.getRelative(BlockFace.NORTH));
|
||||
blocks.add(block.getRelative(BlockFace.SOUTH));
|
||||
blocks.add(block.getRelative(BlockFace.EAST));
|
||||
blocks.add(block.getRelative(BlockFace.WEST));
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
return blocks;
|
||||
|
@ -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>()
|
||||
|
@ -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()
|
||||
|
@ -22,9 +22,7 @@ public class HubClient
|
||||
public int DisplayLength = 16;
|
||||
|
||||
private int _lastGemCount = 0;
|
||||
|
||||
private int _lastCoinCount = 0;
|
||||
|
||||
|
||||
public HubClient(String name)
|
||||
{
|
||||
ScoreboardString = " Welcome " + name + ", to the Mineplex Network!";
|
||||
@ -133,14 +131,4 @@ public class HubClient
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
public void SetLastCoinCount(int coins)
|
||||
{
|
||||
_lastCoinCount = coins;
|
||||
}
|
||||
|
||||
public int GetLastCoinCount()
|
||||
{
|
||||
return _lastCoinCount;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
private HashMap<Player, Scoreboard> _scoreboards = new HashMap<Player, Scoreboard>();
|
||||
|
||||
private String _serverName = "";
|
||||
|
||||
private int _lastPlayerCount = 0;
|
||||
private boolean _shuttingDown;
|
||||
|
||||
private HashMap<String, Long> _portalTime = new HashMap<String, Long>();
|
||||
@ -728,15 +728,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Space
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
//Coins
|
||||
obj.getScore(C.cYellow + C.Bold + "Coins").setScore(line--);
|
||||
//Players
|
||||
obj.getScore(C.cYellow + C.Bold + "Players").setScore(line--);
|
||||
|
||||
// Remove Old
|
||||
player.getScoreboard().resetScores(Get(player.getName()).GetLastCoinCount() + "");
|
||||
// Add New
|
||||
obj.getScore(GetDonation().Get(player.getName()).getCoins() + "").setScore(line--);
|
||||
|
||||
Get(player.getName()).SetLastCoinCount(GetDonation().Get(player.getName()).getCoins());
|
||||
player.getScoreboard().resetScores(_lastPlayerCount + "");
|
||||
|
||||
_lastPlayerCount++;
|
||||
|
||||
obj.getScore(_lastPlayerCount + "").setScore(line--);
|
||||
|
||||
|
||||
//Space
|
||||
|
@ -65,7 +65,7 @@ public class HubVisibilityManager extends MiniPlugin
|
||||
{
|
||||
boolean hideMe = Manager.GetTutorial().InTutorial(player) ||
|
||||
UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 ||
|
||||
Manager.getPreferences().Get(player).Invisibility ||
|
||||
(Manager.getPreferences().Get(player).Invisibility && Manager.GetClients().Get(player).GetRank().has(Rank.MODERATOR)) ||
|
||||
_hiddenPlayers.contains(player);
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user