All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.cwcode.commands.paperplatform.features.ItemFromBase64Command Maven / Gradle / Ivy

package ru.cwcode.commands.paperplatform.features;

import org.bukkit.inventory.ItemStack;
import ru.cwcode.commands.paperplatform.executor.Executor;
import ru.cwcode.cwutils.messages.MessageReturn;
import ru.cwcode.cwutils.messages.TargetableMessageReturn;

import java.util.Base64;

public class ItemFromBase64Command extends Executor {
  @Override
  public void executeForPlayer() throws MessageReturn, TargetableMessageReturn {
    String base64 = argS(1);
    
    ItemStack itemStack = ItemStack.deserializeBytes(Base64.getDecoder().decode(base64));
    
    player().getInventory().addItem(itemStack);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy