mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-30 04:19:28 +00:00
work for better reloads
This commit is contained in:
@@ -7,6 +7,7 @@ import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
||||
import com.hibiscusmc.hmccosmetics.config.serializer.ItemSerializer;
|
||||
import com.hibiscusmc.hmccosmetics.config.serializer.LocationSerializer;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
||||
import com.hibiscusmc.hmccosmetics.database.Database;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||
@@ -14,8 +15,11 @@ import com.hibiscusmc.hmccosmetics.hooks.items.ItemHooks;
|
||||
import com.hibiscusmc.hmccosmetics.listener.PlayerConnectionListener;
|
||||
import com.hibiscusmc.hmccosmetics.listener.PlayerGameListener;
|
||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||
import com.hibiscusmc.hmccosmetics.util.misc.Translation;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -113,6 +117,22 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
||||
// Menus setup
|
||||
Menus.setup();
|
||||
|
||||
// For reloads
|
||||
/*
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
CosmeticUser user = CosmeticUsers.getUser(player.getUniqueId());
|
||||
if (user == null) continue;
|
||||
for (Cosmetic cosmetic : user.getCosmetic()) {
|
||||
Color color = user.getCosmeticColor(cosmetic.getSlot());
|
||||
Cosmetic newCosmetic = Cosmetics.getCosmetic(cosmetic.getId());
|
||||
user.removeCosmeticSlot(cosmetic);
|
||||
|
||||
if (newCosmetic == null) continue;
|
||||
user.addPlayerCosmetic(newCosmetic, color);
|
||||
}
|
||||
user.updateCosmetic();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public static boolean isDisable() {
|
||||
|
||||
@@ -43,12 +43,12 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
menu.openMenu(user);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
else if (args[0].equalsIgnoreCase("reload")) {
|
||||
HMCCosmeticsPlugin.setup();
|
||||
sender.sendMessage("Reloaded.");
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("apply")) {
|
||||
else if (args[0].equalsIgnoreCase("apply")) {
|
||||
sender.sendMessage("Applying - Begin");
|
||||
Player player = null;
|
||||
Cosmetic cosmetic;
|
||||
@@ -70,7 +70,7 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
sender.sendMessage("Applying - Finish with " + cosmetic.getId());
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("unapply")) {
|
||||
else if (args[0].equalsIgnoreCase("unapply")) {
|
||||
Player player = null;
|
||||
CosmeticSlot cosmeticSlot;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
user.updateCosmetic(cosmeticSlot);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("wardrobe")) {
|
||||
else if (args[0].equalsIgnoreCase("wardrobe")) {
|
||||
Player player = null;
|
||||
|
||||
if (sender instanceof Player) player = ((Player) sender).getPlayer();
|
||||
@@ -107,7 +107,7 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
// cosmetic menu exampleMenu playerName
|
||||
if (args[0].equalsIgnoreCase("menu")) {
|
||||
else if (args[0].equalsIgnoreCase("menu")) {
|
||||
if (args.length == 1) return true;
|
||||
Menu menu = Menus.getMenu(args[1]);
|
||||
Player player = null;
|
||||
@@ -124,7 +124,7 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("dataclear")) {
|
||||
else if (args[0].equalsIgnoreCase("dataclear")) {
|
||||
if (args.length == 1) return true;
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
||||
if (player == null) return true;
|
||||
@@ -140,6 +140,20 @@ public class CosmeticCommand implements CommandExecutor {
|
||||
if (user == null) return true;
|
||||
DyeMenu.openMenu(user, user.getCosmetic(CosmeticSlot.valueOf(args[1])));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("dump") && args.length == 1) {
|
||||
Player player = sender instanceof Player ? (Player) sender : null;
|
||||
if (player == null) return true;
|
||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||
if (user == null) return true;
|
||||
player.sendMessage("Passengers -> " + player.getPassengers());
|
||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||
player.sendMessage("Backpack Location -> " + user.getBackpackEntity().getLocation());
|
||||
}
|
||||
player.sendMessage("Cosmetics -> " + user.getCosmetic());
|
||||
player.sendMessage("EntityId -> " + player.getEntityId());
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user