From 3b77b22904168a86f66eb70e674589243c8675f4 Mon Sep 17 00:00:00 2001 From: SBPrime Date: Sat, 24 Dec 2016 21:30:48 +0100 Subject: [PATCH] Update to MC 1.11 --- MidiPlayer/nbproject/build-impl.xml | 7 +++--- MidiPlayer/nbproject/genfiles.properties | 4 +-- MidiPlayer/nbproject/project.properties | 5 ++-- .../scrap/notePlayer/PackageNotePlayer.java | 2 +- .../midiplayer/mcstats/MetricsLite.java | 2 +- .../midiplayer/track/BasePlayerTrack.java | 24 +++++++++--------- .../primesoft/midiplayer/track/BaseTrack.java | 25 ++++++++++++++----- .../midiplayer/track/GlobalTrack.java | 9 ++----- .../midiplayer/track/LocationTrack.java | 2 +- .../midiplayer/track/PlayerTrack.java | 8 +----- MidiPlayer/src/plugin.yml | 2 +- 11 files changed, 47 insertions(+), 43 deletions(-) diff --git a/MidiPlayer/nbproject/build-impl.xml b/MidiPlayer/nbproject/build-impl.xml index 25dc11e..c26a41f 100644 --- a/MidiPlayer/nbproject/build-impl.xml +++ b/MidiPlayer/nbproject/build-impl.xml @@ -244,6 +244,7 @@ is divided into following sections: + @@ -720,7 +721,7 @@ is divided into following sections: - + @@ -800,7 +801,7 @@ is divided into following sections: - + @@ -827,7 +828,7 @@ is divided into following sections: - + diff --git a/MidiPlayer/nbproject/genfiles.properties b/MidiPlayer/nbproject/genfiles.properties index aa9de61..4814761 100644 --- a/MidiPlayer/nbproject/genfiles.properties +++ b/MidiPlayer/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=8064a381@1.75.2.48 # 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 diff --git a/MidiPlayer/nbproject/project.properties b/MidiPlayer/nbproject/project.properties index 99325f5..c94bab4 100644 --- a/MidiPlayer/nbproject/project.properties +++ b/MidiPlayer/nbproject/project.properties @@ -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 diff --git a/MidiPlayer/scrap/notePlayer/PackageNotePlayer.java b/MidiPlayer/scrap/notePlayer/PackageNotePlayer.java index 2f836b7..764f467 100644 --- a/MidiPlayer/scrap/notePlayer/PackageNotePlayer.java +++ b/MidiPlayer/scrap/notePlayer/PackageNotePlayer.java @@ -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"); diff --git a/MidiPlayer/src/org/primesoft/midiplayer/mcstats/MetricsLite.java b/MidiPlayer/src/org/primesoft/midiplayer/mcstats/MetricsLite.java index e2911df..9031ba2 100644 --- a/MidiPlayer/src/org/primesoft/midiplayer/mcstats/MetricsLite.java +++ b/MidiPlayer/src/org/primesoft/midiplayer/mcstats/MetricsLite.java @@ -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 diff --git a/MidiPlayer/src/org/primesoft/midiplayer/track/BasePlayerTrack.java b/MidiPlayer/src/org/primesoft/midiplayer/track/BasePlayerTrack.java index 330355e..de72bea 100644 --- a/MidiPlayer/src/org/primesoft/midiplayer/track/BasePlayerTrack.java +++ b/MidiPlayer/src/org/primesoft/midiplayer/track/BasePlayerTrack.java @@ -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(); diff --git a/MidiPlayer/src/org/primesoft/midiplayer/track/BaseTrack.java b/MidiPlayer/src/org/primesoft/midiplayer/track/BaseTrack.java index fc13c57..16f7b42 100644 --- a/MidiPlayer/src/org/primesoft/midiplayer/track/BaseTrack.java +++ b/MidiPlayer/src/org/primesoft/midiplayer/track/BaseTrack.java @@ -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(); } @@ -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++; diff --git a/MidiPlayer/src/org/primesoft/midiplayer/track/GlobalTrack.java b/MidiPlayer/src/org/primesoft/midiplayer/track/GlobalTrack.java index 9ec004a..3708941 100644 --- a/MidiPlayer/src/org/primesoft/midiplayer/track/GlobalTrack.java +++ b/MidiPlayer/src/org/primesoft/midiplayer/track/GlobalTrack.java @@ -59,12 +59,7 @@ 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) { @@ -72,7 +67,7 @@ public GlobalTrack(JavaPlugin plugin, NoteFrame[] notes) { } public GlobalTrack(JavaPlugin plugin, NoteFrame[] notes, boolean loop) { - super(notes, loop); + super(notes, loop, true); m_plugin = plugin; } } \ No newline at end of file diff --git a/MidiPlayer/src/org/primesoft/midiplayer/track/LocationTrack.java b/MidiPlayer/src/org/primesoft/midiplayer/track/LocationTrack.java index c854b33..920f780 100644 --- a/MidiPlayer/src/org/primesoft/midiplayer/track/LocationTrack.java +++ b/MidiPlayer/src/org/primesoft/midiplayer/track/LocationTrack.java @@ -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; } diff --git a/MidiPlayer/src/org/primesoft/midiplayer/track/PlayerTrack.java b/MidiPlayer/src/org/primesoft/midiplayer/track/PlayerTrack.java index 1c92282..fac3be0 100644 --- a/MidiPlayer/src/org/primesoft/midiplayer/track/PlayerTrack.java +++ b/MidiPlayer/src/org/primesoft/midiplayer/track/PlayerTrack.java @@ -40,7 +40,6 @@ */ package org.primesoft.midiplayer.track; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.primesoft.midiplayer.midiparser.NoteFrame; @@ -51,11 +50,6 @@ * @author SBPrime */ public class PlayerTrack extends BasePlayerTrack { - - @Override - protected Location getLocation() { - return null; - } public PlayerTrack(NoteFrame[] notes) { this(notes, false); @@ -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); } } diff --git a/MidiPlayer/src/plugin.yml b/MidiPlayer/src/plugin.yml index a0495d3..1ea065f 100644 --- a/MidiPlayer/src/plugin.yml +++ b/MidiPlayer/src/plugin.yml @@ -1,6 +1,6 @@ name: MidiPlayer main: org.primesoft.midiplayer.MidiPlayerMain -version: 0.1.0 +version: 0.2.0 website: dev-url: description: