mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-30 04:19:28 +00:00
Mainhand mostly works
This commit is contained in:
@@ -11,6 +11,7 @@ import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||
import com.hibiscusmc.hmccosmetics.util.InventoryUtils;
|
||||
@@ -156,16 +157,14 @@ public class PlayerGameListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMainHandSwitch(PlayerItemHeldEvent event) {
|
||||
HMCCosmeticsPlugin.getInstance().getLogger().info("PlayerItemHeldEvent");
|
||||
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer());
|
||||
if (user == null) return;
|
||||
HMCCosmeticsPlugin.getInstance().getLogger().info("PlayerItemHeldEvent 2");
|
||||
|
||||
|
||||
|
||||
event.getPreviousSlot();
|
||||
|
||||
user.updateCosmetic(CosmeticSlot.MAINHAND);
|
||||
event.getPlayer().getInventory().setItem(event.getPreviousSlot(), event.getPlayer().getInventory().getItem(event.getPreviousSlot()));
|
||||
//NMSHandlers.getHandler().slotUpdate(event.getPlayer(), event.getPreviousSlot());
|
||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||
user.updateCosmetic(CosmeticSlot.MAINHAND);
|
||||
}, 2);
|
||||
}
|
||||
|
||||
private void registerInventoryClickListener() {
|
||||
|
||||
@@ -32,6 +32,10 @@ public interface NMSHandler {
|
||||
List<Player> sendTo
|
||||
);
|
||||
|
||||
void slotUpdate(
|
||||
Player player,
|
||||
int slot
|
||||
);
|
||||
|
||||
default boolean getSupported () {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user