Update sounds to 1.9, fix compile

This commit is contained in:
vemacs 2016-03-01 17:05:57 -07:00
parent 37c20d5b6d
commit 526118e7d3
3 changed files with 114 additions and 18 deletions

View File

@ -1,6 +1,8 @@
package com.earth2me.essentials;
import org.bukkit.*;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
@ -98,21 +100,6 @@ public class OfflinePlayer implements Player {
public void setHealth(double d) {
}
@Override
public Egg throwEgg() {
return null;
}
@Override
public Snowball throwSnowball() {
return null;
}
@Override
public Arrow shootArrow() {
return null;
}
@Override
public boolean isInsideVehicle() {
return false;
@ -901,6 +888,11 @@ public class OfflinePlayer implements Player {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openMerchant(Villager villager, boolean b) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void closeInventory() {
throw new UnsupportedOperationException("Not supported yet.");
@ -1101,6 +1093,16 @@ public class OfflinePlayer implements Player {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setGlowing(boolean b) {
}
@Override
public boolean isGlowing() {
return false;
}
@Override
public void setPlayerWeather(WeatherType arg0) {
throw new UnsupportedOperationException("Not supported yet.");
@ -1321,8 +1323,73 @@ public class OfflinePlayer implements Player {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void spawnParticle(Particle particle, Location location, int i) {
}
@Override
public void spawnParticle(Particle particle, double v, double v1, double v2, int i) {
}
@Override
public <T> void spawnParticle(Particle particle, Location location, int i, T t) {
}
@Override
public <T> void spawnParticle(Particle particle, double v, double v1, double v2, int i, T t) {
}
@Override
public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2) {
}
@Override
public void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5) {
}
@Override
public <T> void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2, T t) {
}
@Override
public <T> void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, T t) {
}
@Override
public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2, double v3) {
}
@Override
public void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6) {
}
@Override
public <T> void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2, double v3, T t) {
}
@Override
public <T> void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t) {
}
@Override
public void sendTitle(String title, String subtitle) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public AttributeInstance getAttribute(Attribute attribute) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -134,8 +134,15 @@ public class Commandessentials extends EssentialsCommand {
if (note == null || note.isEmpty()) {
return;
}
Sound noteHarp;
try {
noteHarp = Sound.valueOf("NOTE_PIANO"); // pre-1.9, referenced internally as note.harp
} catch (IllegalArgumentException e) {
noteHarp = Sound.valueOf("BLOCK_NOTE_HARP"); // 1.9
}
for (Player onlinePlayer : ess.getOnlinePlayers()) {
onlinePlayer.playSound(onlinePlayer.getLocation(), Sound.NOTE_PIANO, 1, noteMap.get(note));
onlinePlayer.playSound(onlinePlayer.getLocation(), noteHarp, 1, noteMap.get(note));
}
}
}, 20, 2);
@ -155,19 +162,25 @@ public class Commandessentials extends EssentialsCommand {
private final String[] playerMoo = new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..."};
private void run_moo(final Server server, final CommandSource sender, final String command, final String args[]) {
Sound moo;
try {
moo = Sound.valueOf("COW_IDLE"); // pre-1.9
} catch (IllegalArgumentException e) {
moo = Sound.valueOf("ENTITY_COW_MILK"); // 1.9
}
if (args.length == 2 && args[1].equals("moo")) {
for (String s : consoleMoo) {
logger.info(s);
}
for (Player player : ess.getOnlinePlayers()) {
player.sendMessage(playerMoo);
player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f);
player.playSound(player.getLocation(), moo, 1, 1.0f);
}
} else {
if (sender.isPlayer()) {
sender.getSender().sendMessage(playerMoo);
final Player player = sender.getPlayer();
player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f);
player.playSound(player.getLocation(), moo, 1, 1.0f);
} else {
sender.getSender().sendMessage(consoleMoo);

View File

@ -5,6 +5,10 @@ import com.earth2me.essentials.craftbukkit.FakeWorld;
import org.bukkit.*;
import org.bukkit.Warning.WarningState;
import org.bukkit.World.Environment;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
@ -16,6 +20,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.help.HelpMap;
import org.bukkit.inventory.*;
import org.bukkit.map.MapView;
@ -34,6 +39,7 @@ import org.bukkit.util.CachedServerIcon;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
@ -909,6 +915,16 @@ public class FakeServer implements Server {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ChunkGenerator.ChunkData createChunkData(World world) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public BossBar createBossBar(String s, BarColor barColor, BarStyle barStyle, BarFlag... barFlags) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public UnsafeValues getUnsafe() {
throw new UnsupportedOperationException("Not supported yet.");