mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2026-01-02 05:46:42 +00:00
dye menu impl
This commit is contained in:
@@ -7,8 +7,10 @@ import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
||||
import com.hibiscusmc.hmccosmetics.database.Database;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||
import com.hibiscusmc.hmccosmetics.gui.special.DyeMenu;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||
import io.th0rgal.oraxen.utils.logs.Logs;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -17,6 +19,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class CosmeticCommand implements CommandExecutor {
|
||||
|
||||
// cosmetics apply cosmetics playerName
|
||||
@@ -115,6 +119,15 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
if (player == null) return true;
|
||||
Database.clearData(player.getUniqueId());
|
||||
sender.sendMessage("Cleared data for " + player.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("dye") && args.length == 2) {
|
||||
Player player = sender instanceof Player ? (Player) sender : null;
|
||||
if (player == null) return true;
|
||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||
if (user == null) return true;
|
||||
DyeMenu.openMenu(user, user.getCosmetic(CosmeticSlot.valueOf(args[1])));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -28,6 +29,7 @@ public class CosmeticCommandTabComplete implements TabCompleter {
|
||||
completions.add("menu");
|
||||
completions.add("reload");
|
||||
completions.add("dataclear");
|
||||
completions.add("dye");
|
||||
}
|
||||
|
||||
// This needs to be redone.
|
||||
@@ -44,6 +46,9 @@ public class CosmeticCommandTabComplete implements TabCompleter {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
completions.add(player.getName());
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("dye")) {
|
||||
completions.add(CosmeticSlot.BALLOON.name());
|
||||
completions.add(CosmeticSlot.BACKPACK.name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user