From fb59bf431705579978fbca6f315b473b1deab914 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 11:22:45 +0100 Subject: [PATCH] Fixing player.playSound in 1.8 --- .../de/steamwar/comms/BungeeReceiver_8.java | 30 +++++++++++++++++++ .../de/steamwar/comms/BungeeReceiver_9.java | 30 +++++++++++++++++++ .../src/de/steamwar/comms/BungeeReceiver.java | 8 +++-- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java create mode 100644 SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java diff --git a/SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java b/SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java new file mode 100644 index 0000000..2b2ce08 --- /dev/null +++ b/SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java @@ -0,0 +1,30 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ + +package de.steamwar.comms; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +public class BungeeReceiver_8 { + + public static void playPling(Player player) { + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1); + } +} diff --git a/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java b/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java new file mode 100644 index 0000000..685b65a --- /dev/null +++ b/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java @@ -0,0 +1,30 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ + +package de.steamwar.comms; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +public class BungeeReceiver_9 { + + public static void playpling(Player player) { + player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 5ebdcae..103e72f 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -23,9 +23,9 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; import de.steamwar.comms.handlers.BungeeHandler; import de.steamwar.comms.handlers.InventoryHandler; +import de.steamwar.core.Core; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; -import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; @@ -46,7 +46,11 @@ public class BungeeReceiver implements PluginMessageListener { UUID uuid = SteamwarUser.get(byteArrayDataInput.readInt()).getUUID(); if(Bukkit.getPlayer(uuid).isOnline()) { Player player = Bukkit.getPlayer(uuid); - player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); + if (Core.getVersion() == 8) { + BungeeReceiver_8.playPling(player); + } else { + BungeeReceiver_9.playpling(player); + } } });