Crazy Auction custom sell price

Discussion in 'Plugin Development' started by deginech, Aug 8, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    deginech

    In CA you can only write a price in command /ca sell %price%.
    For my server, i tried to make it easier with npc you clicking on, and enter your price, but id doesnt work at all. Not even messages in the log.

    In general, i tried to create this:

    if executed /youridea
    send message "enter price"
    get player's message
    execute "/ca sell" + player's message

    main class:
    Code:
    package me.deginech.uridea;
    
    import me.deginech.uridea.sender.youridea;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerRespawnEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public final class URIDEA extends JavaPlugin implements Listener{
    
        @Override
        public void onEnable() {
            System.out.println("You pick ou the wrong door.");
            getCommand("youridea").setExecutor(new youridea());
        }
        @Override
        public void onDisable() {
            System.out.println("My battery is low, and it's getting dark");
        }
    }
    another one:
    Code:
    package me.deginech.uridea.sender;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    
    public class youridea implements CommandExecutor, Listener {
    
    
        @EventHandler
        public boolean onCommand(AsyncPlayerChatEvent event, CommandSender sender, Command command, String label, String[] args){
            if(sender instanceof Player){
                Player player = (Player) sender;
                player.sendMessage("ยง6Enter your price.");
                String msg = event.getMessage();
                event.setCancelled(true);
                player.performCommand("ca sell" + msg);
            }
            return false;
        }
    
        @Override
        public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
            return false;
        }
    }
    Core - Paper-spigot 1.16.1
    Please, tell me, what i did wrong?
     
    Last edited: Aug 8, 2020
  2. Offline

    harura

    looks interesting
     
Thread Status:
Not open for further replies.

Share This Page