62 lines
3.6 KiB
Java
62 lines
3.6 KiB
Java
package net.t2code.commandguiv2.Spigot.sound;
|
|
|
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigValues;
|
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
|
import net.t2code.commandguiv2.Spigot.objects.FunctionObject;
|
|
import net.t2code.commandguiv2.Spigot.objects.GuiObject;
|
|
import net.t2code.commandguiv2.Spigot.objects.SlotObject;
|
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
|
import net.t2code.commandguiv2.Util;
|
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public class PlaySound {
|
|
private static String prefix = Util.getPrefix();
|
|
|
|
public static void play(Player player, SoundEnum soundEnum) {
|
|
play(player, soundEnum, null, null, null);
|
|
}
|
|
|
|
public static void play(Player player, SoundEnum soundEnum, FunctionObject function, SlotObject slot, GuiObject gui) {
|
|
if (!(Boolean) ConfigValues.soundEnable.value) return;
|
|
switch (soundEnum) {
|
|
case OpenInventory:
|
|
if (!(Boolean) ConfigValues.soundOpenInventoryEnable.value) return;
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundOpenInventoryInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
break;
|
|
case Click:
|
|
if (!(Boolean) ConfigValues.soundClickEnable.value) return;
|
|
if (!function.customSound_Enable) {
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
return;
|
|
}
|
|
|
|
if (function.customSound_NoSound) return;
|
|
try {
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
|
} catch (Exception e1) {
|
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
|
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundClickInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
}
|
|
break;
|
|
case NoMoney:
|
|
if (!(Boolean) ConfigValues.soundNoMoneyEnable.value) return;
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundNoMoneyInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
break;
|
|
case NoInventorySpace:
|
|
if (!(Boolean) ConfigValues.soundNoInventorySpaceEnable.value) return;
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundNoInventorySpaceInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
break;
|
|
case Give:
|
|
if (!(Boolean) ConfigValues.soundGiveEnable.value) return;
|
|
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf(String.valueOf( ConfigValues.soundGiveInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
break;
|
|
case PlayerNotFound:
|
|
if (!(Boolean) ConfigValues.soundPlayerNotFoundEnable.value) return;
|
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(String.valueOf(ConfigValues.soundPlayerNotFoundInput.value).toUpperCase().replace(".", "_")), 3, 1);
|
|
break;
|
|
}
|
|
}
|
|
}
|