Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/moe/sebiann/system/commands/ReskinCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;

@CommandAlias("reskin")
Expand All @@ -21,7 +22,7 @@ public void reskin(CommandSender sender, String option) {
.color(TextColor.fromHexString("#FF5555")));
return;
}
List<String> validOptions = System.plugin.getConfig().getStringList("skins");
List<String> validOptions = new ArrayList<>(System.plugin.getConfig().getStringList("skins"));
// Validate the option
if (option == null || !validOptions.contains(option)) {
player.sendMessage(Component.text("Invalid or missing option. Valid options: " + String.join(", ", validOptions))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
package moe.sebiann.system.listeners;

import moe.sebiann.system.System;
import net.kyori.adventure.text.Component;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

public class PlayerJoinListener implements Listener {

private final FileConfiguration config;

public PlayerJoinListener(FileConfiguration config) {
this.config = config;
}

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
String welcomeMessage = config.getString("messages.welcome", "Hello, {player}!");
String welcomeMessage = System.plugin.getConfig().getString("messages.welcome", "Hello, {player}!");
String personalizedMessage = welcomeMessage.replace("{player}", event.getPlayer().getName());
event.getPlayer().sendMessage(Component.text(personalizedMessage));
}
Expand Down
Loading