fix: Fix Sound.valueOf compatibility for 1.21.1

- Added null checks in SoundAction.execute()
- Added fallback for Sound enum compatibility
- Fixed IncompatibleClassChangeError on PlayerJoinEvent
- Added SpaceLegacy ready config (spacelegacy-config.yml)
This commit is contained in:
loki5512344 2026-02-24 14:17:44 +01:00
parent 6e99cf9390
commit 0a5acdecb0
2 changed files with 354 additions and 3 deletions

View file

@ -16,9 +16,14 @@ public class SoundAction implements Action {
Sound parsedSound;
try {
parsedSound = Sound.valueOf(parts[0].toUpperCase());
String soundName = parts[0].toUpperCase().trim();
parsedSound = Sound.valueOf(soundName);
} catch (IllegalArgumentException e) {
parsedSound = Sound.ENTITY_EXPERIENCE_ORB_PICKUP;
try {
parsedSound = Sound.ENTITY_EXPERIENCE_ORB_PICKUP;
} catch (NoSuchFieldError ex) {
parsedSound = Sound.valueOf("ENTITY_EXPERIENCE_ORB_PICKUP");
}
}
this.sound = parsedSound;
@ -28,7 +33,9 @@ public class SoundAction implements Action {
@Override
public void execute(Player player) {
player.playSound(player.getLocation(), sound, volume, pitch);
if (player != null && sound != null) {
player.playSound(player.getLocation(), sound, volume, pitch);
}
}
@Override

344
spacelegacy-config.yml Normal file
View file

@ -0,0 +1,344 @@
# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ LoHub Configuration - SpaceLegacy ║
# ║ Hub plugin for Paper/Folia 1.20.1+ ║
# ╚══════════════════════════════════════════════════════════════════════════════╝
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | GENERAL SETTINGS |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
check-updates: true
# Disabled worlds (plugin won't work there)
disabled-worlds:
invert: false
worlds:
- world_nether
- witp
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | SPAWN SETTINGS |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
spawn:
teleport-on-join: true
teleport-on-respawn: true
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | WORLDGUARD INTEGRATION |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
worldguard:
auto-create-region: true
region-radius: 100
region-name: "lohub_spawn"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | WORLD PROTECTION |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
world_settings:
disable_hunger_loss: true
disable_fall_damage: true
disable_player_pvp: true
disable_void_death: true
disable_fire_damage: true
disable_drowning: true
disable_off_hand_swap: true
disable_weather_change: true
disable_death_message: true
disable_mob_spawning: true
disable_item_drop: true
disable_item_pickup: false
disable_block_break: true
disable_block_place: true
disable_block_interact: true
disable_block_burn: true
disable_block_fire_spread: true
disable_block_leaf_decay: true
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | LAUNCHPAD |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
launchpad:
enabled: true
launch_power: 3.0
launch_power_y: 1.0
top_block: STONE_PRESSURE_PLATE
bottom_block: REDSTONE_BLOCK
actions:
- '[SOUND] ENTITY_BAT_TAKEOFF'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | DOUBLE JUMP |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
double_jump:
enabled: false
launch_power: 1.0
launch_power_y: 0.9
cooldown: 3
actions:
- '[SOUND] ENTITY_BAT_TAKEOFF'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | COMMAND BLOCKER |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
command_block:
enabled: true
blocked_commands:
- /pl
- /plugins
- /?
- /bukkit:?
- /bukkit:plugins
- /bukkit:pl
- /bukkit:help
- /ver
- /version
- /bukkit:version
- /bukkit:ver
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | ANTI-SWEAR |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
anti_swear:
enabled: true
blocked_words:
- блять
- сука
- пизда
- хуй
- ебать
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | PLAYER JOIN |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
join_leave_messages:
enabled: true
join_message: "&#B798A8&l▶ &#7858E9%player% &7присоединился"
quit_message: "&c&l◀ &#B798A8%player% &7вышел"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | SERVER SWITCH MESSAGES |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
server_switch_messages:
enabled: true
switch_message: "&#B798A8&l▶ &#7858E9%player% &7подключился к &#B798A8%server%"
server_names:
hub: "Хабу"
vanilla: "Ванилле"
grif: "Грифу"
darktown: "Даркауну"
join_events:
- "[CONSOLE] effect clear %player%"
- "[MESSAGE] &#B798A8&m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
- "[MESSAGE] &r"
- "[MESSAGE] &7Добро пожаловать, &#7858E9&n%player%&r&7!"
- "[MESSAGE] &r"
- "[MESSAGE] &#B798A8&l♦ &#B798A8s&#B192AFp&#AA8BB5a&#A485BCc&#9E7EC2e&#9878C9l&#9172CFe&#8B6BD6g&#8565DCa&#7E5EE3c&#7858E9y"
- "[MESSAGE] &#B798A8&l♦ САЙТ &#7858E9spacelegacy.ru"
- "[MESSAGE] &#B798A8&l♦ DISCORD &f/discord"
- "[MESSAGE] &r"
- "[MESSAGE] &7&oЖелаем приятной игры!"
- "[MESSAGE] &#B798A8&m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
- "[TITLE] &#B798A8s&#B192AFp&#AA8BB5a&#A485BCc&#9E7EC2e&#9878C9l&#9172CFe&#8B6BD6g&#8565DCa&#7E5EE3c&#7858E9y;&fДобро пожаловать!;1;3;1"
- "[SOUND] ENTITY_PLAYER_LEVELUP"
- "[GAMEMODE] survival"
join_settings:
spawn_join: true
heal: true
extinguish: true
clear_inventory: false
firework:
enabled: true
first_join_only: true
type: BALL_LARGE
power: 1
flicker: true
trail: true
colors:
- PURPLE
- WHITE
- BLUE
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | CUSTOM JOIN ITEMS |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
custom_join_items:
enabled: true
disable_inventory_movement: true
items:
parkour:
material: FEATHER
amount: 1
slot: 0
display_name: "&#B798A8&l♦ &#7858E9Паркур"
lore:
- "&7Нажми ПКМ, чтобы перейти на паркур"
actions:
- "[MESSAGE] &#B798A8&m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
- "[MESSAGE] &#B798A8&l♦ &fТелепортация на &#7858E9Паркур&f..."
- "[MESSAGE] &#B798A8&m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
- "[CONSOLE] ip forcejoin %player%"
- "[SOUND] ENTITY_ENDERMAN_TELEPORT"
server_selector:
material: NETHER_STAR
amount: 1
slot: 4
display_name: "&#B798A8&l♦ &#7858E9Выбор Режима"
lore:
- "&7Нажми ПКМ, чтобы выбрать режим"
actions:
- "[MENU] serverselector"
player_hider:
material: LIME_DYE
amount: 1
slot: 8
display_name: '&a&l♦ &#7858E9Игроки видны &7(ПКМ)'
lore:
- '&7Скрыть лишних игроков'
actions:
- "[PLAYER_HIDER]"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | PLAYER HIDER |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
player_hider:
enabled: true
slot: 8
disable_inventory_movement: true
cooldown: 3
not_hidden:
material: LIME_DYE
amount: 1
display_name: '&a&l♦ &#7858E9Игроки видны &7(ПКМ)'
lore:
- '&7Нажми, чтобы скрыть'
hidden:
material: GRAY_DYE
amount: 1
display_name: '&c&l♦ &#B798A8Игроки скрыты &7(ПКМ)'
lore:
- '&7Нажми, чтобы показать'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | SCOREBOARD |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
scoreboard:
enabled: false
display_delay:
server_enter: 60
world_change: 40
refresh:
enabled: true
rate: 200
title: "&#B798A8s&#B192AFp&#AA8BB5a&#A485BCc&#9E7EC2e&#9878C9l&#9172CFe&#8B6BD6g&#8565DCa&#7E5EE3c&#7858E9y"
lines:
- "&#B798A8&m━━━━━━━━━━━━━━━━━━━━━━"
- "&#B798A8◆ &fИгрок&#7858E9:"
- " &7%player%"
- ""
- "&#B798A8◆ &fРанг&#7858E9:"
- " &#7858E9%vault_rank%"
- ""
- "&#B798A8◆ &fОнлайн&#7858E9:"
- " &f%online% игроков"
- "&#B798A8&m━━━━━━━━━━━━━━━━━━━━━━"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | TABLIST |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
tablist:
enabled: true
refresh:
enabled: true
rate: 400
header:
- ""
- " &#B798A8s&#B192AFp&#AA8BB5a&#A485BCc&#9E7EC2e&#9878C9l&#9172CFe&#8B6BD6g&#8565DCa&#7E5EE3c&#7858E9y "
- "&fСервер: &#B798A8s&#B192AFp&#AA8BB5a&#A485BCc&#9E7EC2e&#9878C9l&#9172CFe&#8B6BD6g&#8565DCa&#7E5EE3c&#7858E9y.ru &7| &fОнлайн: &#7858E9%online%"
- ""
footer:
- ""
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&#B798A8◆ &fНаш Discord&#7858E9: &7/discord"
- "&#B798A8◆ &fСайт&#7858E9: &fspacelegacy.ru"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- ""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | ANNOUNCEMENTS |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
announcements:
enabled: true
delay: 120
required_players: 1
sound:
enabled: true
value: BLOCK_NOTE_BLOCK_PLING
volume: 1.0
pitch: 1.5
announcements:
announce1:
- "&r"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&#B798A8&l♦ ОБЪЯВЛЕНИЕ"
- "&7Добро пожаловать на &#B798A8s&#B192AFp&#AA8BB5a&#A485BCc&#9E7EC2e&#9878C9l&#9172CFe&#8B6BD6g&#8565DCa&#7E5EE3c&#7858E9y&7!"
- "&7Приятной игры и честных сражений!"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&r"
announce2:
- "&r"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&#B798A8&l♦ ОБЪЯВЛЕНИЕ"
- "&7Наш Discord для связи с тех-поддержкой:"
- "&#7858E9/discord или /links"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&r"
announce3:
- "&r"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&#B798A8&l♦ ОБЪЯВЛЕНИЕ"
- "&7Наш сайт: &#7858E9spacelegacy.ru"
- "&7Следи за обновлениями сервера!"
- "&#B798A8▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- "&r"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | CUSTOM COMMANDS |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# All custom commands are now in commands.yml
# You can create custom commands with actions there
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# | MESSAGES |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# All messages are now in messages.yml
# You can customize the plugin prefix and all messages there