9/27/2019 - 11:16 PM


package me.illuminatiproductions.youtubeplugin;

import me.illuminatiproductions.youtubeplugin.commands.CreateSign;
import me.illuminatiproductions.youtubeplugin.events.SignEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class YoutubePlugin extends JavaPlugin {

    public void onEnable() {
        // Plugin startup logic
        getCommand("sign").setExecutor(new CreateSign());

        getServer().getPluginManager().registerEvents(new SignEvent(), this);
package me.illuminatiproductions.youtubeplugin.commands;

import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class CreateSign implements CommandExecutor {

    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player){
            Player player = (Player) sender;
            if (args.length != 2){
                player.sendMessage("You need to specify a line and word");
                player.sendMessage("Like this: /sign 3 bacon");
            }else if(args.length == 2){
                //Put a sign at a players location
                //Get an instance of the sign so you can edit it
                Sign sign = (Sign) player.getWorld().getBlockAt(player.getLocation()).getState();

                int line = Integer.parseInt(args[0]) - 1; //The line the player specified
                String word = args[1]; //Word the player specified
                sign.setLine(line, word); //Edit the sign
                //Update the state of the sign
            //Can be used to place a sign
            //Get the sign/block
            //Sign sign1 = (Sign) player.getWorld().getBlockAt(player.getLocation()).getState();
            //sign1.setLine(1, "Booty"); //Edit the signs second line
            // sign1.update(); //Updates the state of the sign

        return true;
package me.illuminatiproductions.youtubeplugin.events;

import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent;

public class SignEvent implements Listener {

    public void onSignSomething(SignChangeEvent e){