Skip to content

Commit

Permalink
Update to MC 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
SBPrime committed Dec 24, 2016
1 parent 66257ee commit 3b77b22
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 43 deletions.
7 changes: 4 additions & 3 deletions MidiPlayer/nbproject/build-impl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ is divided into following sections:
<condition else="" property="testng.debug.mode" value="-mixed">
<istrue value="${junit+testng.available}"/>
</condition>
<property name="java.failonerror" value="true"/>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
Expand Down Expand Up @@ -720,7 +721,7 @@ is divided into following sections:
<sequential>
<property environment="env"/>
<resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
<java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
<java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg line="${profiler.info.jvmargs}"/>
Expand Down Expand Up @@ -800,7 +801,7 @@ is divided into following sections:
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" jvm="${platform.java}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
Expand All @@ -827,7 +828,7 @@ is divided into following sections:
<attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" jvm="${platform.java}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
Expand Down
4 changes: 2 additions & 2 deletions MidiPlayer/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ [email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=c24456d5
nbproject/build-impl.xml.script.CRC32=7102cefd
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
nbproject/build-impl.xml.script.CRC32=e7e17c29
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
5 changes: 3 additions & 2 deletions MidiPlayer/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ dist.jar=${dist.dir}/MidiPlayer.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.craftbukkit.jar=lib/craftbukkit.jar
file.reference.spigot-1.11.2.jar=lib/spigot-1.11.2.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.craftbukkit.jar}:
${file.reference.spigot-1.11.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=false
javac.processorpath=\
${javac.classpath}
javac.source=1.6
Expand Down
2 changes: 1 addition & 1 deletion MidiPlayer/scrap/notePlayer/PackageNotePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static PackageNotePlayer create(Server server) {

final String serverPackage = String.format("net.minecraft.server.%s", version);

Class<?> craftPlayerClass = Reflection.classFromName(String.format("org.bukkit.craftbukkit.%s.entity", version),
Class<?> craftPlayerClass = Reflection.classFromName(String.format("org.bukkit.craftbukkit+v1_9_R1v1_8_R3.%s.entity", version),
"CraftPlayer", "Unable to create CraftPlayer class");
Class<?> entityPlayerClass = Reflection.classFromName(serverPackage, "EntityPlayer",
"Unable to create EntityPlayer class");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private void postPlugin(boolean isPing) throws IOException {
data.append(encode("guid")).append('=').append(encode(guid));
encodeDataPair(data, "version", description.getVersion());
encodeDataPair(data, "server", Bukkit.getVersion());
encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length));
encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().size()));
encodeDataPair(data, "revision", String.valueOf(REVISION));

// If we're pinging, append it
Expand Down
24 changes: 12 additions & 12 deletions MidiPlayer/src/org/primesoft/midiplayer/track/BasePlayerTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,28 @@ protected Player[] getPlayers() {
}
}

public BasePlayerTrack(NoteFrame[] notes) {
this(notes, false);
public BasePlayerTrack(NoteFrame[] notes, boolean singleLocation) {
this(notes, false, singleLocation);
}

public BasePlayerTrack(NoteFrame[] notes, boolean loop) {
this((Player[])null, notes, loop);
public BasePlayerTrack(NoteFrame[] notes, boolean loop, boolean singleLocation) {
this((Player[])null, notes, loop, singleLocation);
}

public BasePlayerTrack(Player[] initialPlayers, NoteFrame[] notes) {
this(initialPlayers, notes, false);
public BasePlayerTrack(Player[] initialPlayers, NoteFrame[] notes, boolean singleLocation) {
this(initialPlayers, notes, false, singleLocation);
}

public BasePlayerTrack(Player initialPlayer, NoteFrame[] notes) {
this(initialPlayer, notes, false);
public BasePlayerTrack(Player initialPlayer, NoteFrame[] notes, boolean singleLocation) {
this(initialPlayer, notes, false, singleLocation);
}

public BasePlayerTrack(Player initialPlayer, NoteFrame[] notes, boolean loop) {
this(new Player[]{initialPlayer}, notes, loop);
public BasePlayerTrack(Player initialPlayer, NoteFrame[] notes, boolean loop, boolean singleLocation) {
this(new Player[]{initialPlayer}, notes, loop, singleLocation);
}

public BasePlayerTrack(Player[] initialPlayers, NoteFrame[] notes, boolean loop) {
super(notes, loop);
public BasePlayerTrack(Player[] initialPlayers, NoteFrame[] notes, boolean loop, boolean singleLocation) {
super(notes, loop, singleLocation);

m_players = new HashSet<Player>();

Expand Down
25 changes: 19 additions & 6 deletions MidiPlayer/src/org/primesoft/midiplayer/track/BaseTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,17 @@ public abstract class BaseTrack {
* Next note to play
*/
private NoteFrame m_nextNote;

/**
* Use the per player sound location
*/
private final boolean m_perPlayerLocation;

public BaseTrack(NoteFrame[] notes, boolean loop) {
protected BaseTrack(NoteFrame[] notes, boolean loop, boolean singleLocation) {
m_isLooped = loop;
m_notes = notes;

m_perPlayerLocation = !singleLocation;

rewind();
}

Expand All @@ -116,22 +122,29 @@ public final void rewind() {
*/
protected abstract Player[] getPlayers();

/**
* Get the sound global location
* (if null the get player location wil be used)
* @return
*/
protected Location getLocation() { return null; }

/**
* Get the sound location
*
* @param player The player to get the location for
* @return
*/
protected abstract Location getLocation();
protected Location getLocation(Player player) { return null; }

public void play(long delta) {
m_wait -= delta;

final Player[] players = getPlayers();
final Location location = getLocation();
final Location location = m_perPlayerLocation ? null : getLocation();

while (m_wait <= HALF_TICK && m_nextNote != null) {
for (Player p : players) {
m_nextNote.play(p, location);
m_nextNote.play(p, m_perPlayerLocation ? getLocation(p) : location);
}

m_pos++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,15 @@ public class GlobalTrack extends BaseTrack {
@Override
protected Player[] getPlayers() {
//TODO: Optimize me!
return m_plugin.getServer().getOnlinePlayers();
}

@Override
protected Location getLocation() {
return null;
return m_plugin.getServer().getOnlinePlayers().toArray(new Player[0]);
}

public GlobalTrack(JavaPlugin plugin, NoteFrame[] notes) {
this(plugin, notes, false);
}

public GlobalTrack(JavaPlugin plugin, NoteFrame[] notes, boolean loop) {
super(notes, loop);
super(notes, loop, true);
m_plugin = plugin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public LocationTrack(Location location, Player initialPlayer, NoteFrame[] notes,
}

public LocationTrack(Location location, Player[] initialPlayers, NoteFrame[] notes, boolean loop) {
super(initialPlayers, notes, loop);
super(initialPlayers, notes, loop, true);

m_location = location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
*/
package org.primesoft.midiplayer.track;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.primesoft.midiplayer.midiparser.NoteFrame;

Expand All @@ -51,11 +50,6 @@
* @author SBPrime
*/
public class PlayerTrack extends BasePlayerTrack {

@Override
protected Location getLocation() {
return null;
}

public PlayerTrack(NoteFrame[] notes) {
this(notes, false);
Expand All @@ -78,6 +72,6 @@ public PlayerTrack(Player initialPlayer, NoteFrame[] notes, boolean loop) {
}

public PlayerTrack(Player[] initialPlayers, NoteFrame[] notes, boolean loop) {
super(initialPlayers, notes, loop);
super(initialPlayers, notes, loop, false);
}
}
2 changes: 1 addition & 1 deletion MidiPlayer/src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: MidiPlayer
main: org.primesoft.midiplayer.MidiPlayerMain
version: 0.1.0
version: 0.2.0
website:
dev-url:
description:
Expand Down

0 comments on commit 3b77b22

Please sign in to comment.