• 0

    posted a message on Need help with Bukkit coding

    I can't get a chat serializer working with ChatColor.translateAlternateColorCodes(). Any help?


    Here's my code

    package com.hammy016.newcommands.commands;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
    import org.bukkit.entity.Player;
    
    import com.hammy016.newcommands.Main;
    
    import net.minecraft.server.v1_9_R1.IChatBaseComponent.ChatSerializer;
    import net.minecraft.server.v1_9_R1.PacketPlayOutChat;
    import net.minecraft.server.v1_9_R1.PlayerConnection;
    
    public class Info implements CommandExecutor {
    
    	private Main plugin;
    
    	public Info(Main pl) {
    		plugin = pl;
    	}
    
    	public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    		if (!(sender instanceof Player)) {
    			sender.sendMessage(ChatColor.RED + ("You must be in-game to use this command!"));
    
    			return false;
    		}
    		
    		Player player = (Player) sender;
    		PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
    		PacketPlayOutChat packet = new PacketPlayOutChat(ChatSerializer.a("{\"text\":\"" + (ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("prefix"), plugin.getConfig().getString("infomessage")) + "\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://kingdomcraftmc.com\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"This is a link to our server website!\",\"color\":\"gold\"}]}}}")));
    
    		connection.sendPacket(packet);
    		return true;
    	}
    
    }



    And here's the config:


    # Testing configuration files!
    # Version 1.0
    
    infomessage: 'Click &6here&r to go the the server website!'
    prefix: '[&bKCMC &6Announcer&f] '



    Thanks!

    Posted in: Server Support and Administration
  • 0

    posted a message on Looking for staff (Especially Java developers)

    No money

    Posted in: Server Recruitment
  • 0

    posted a message on Help! I'm terrible at coding!

    Hey guys. I've recently started making Spigot plugins, but I can't seem to make them work. I was trying to make a /hello command that prints hello in the chat to the sender, but whenever I load the plugin on my server it says the command doesn't exist.


    Here's my code:

    package com.hammy016.cmd;
    
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class main extends JavaPlugin {
    
    	@Override
    	public void onEnable() {
    		System.out.println("Test");
    	}
    
    	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    
    		if (cmd.getName().equalsIgnoreCase("hello")) {
    			if (sender instanceof Player) {
    				Player player = (Player) sender;
    				player.sendMessage(ChatColor.GREEN + "Hello! :)");
    				return true;
    			} else {
    				sender.sendMessage("Hello! :D");
    				return true;
    			}
    		}
    
    		return false;
    	}
    }
    


    And my plugin.yml:

    main: com.hammy016.cmd.main
    version: 1.0
    name: testing
    
    commands:
     hello:
     description: A nice little greeting!

    Posted in: Discussion
  • 0

    posted a message on Looking for staff (Especially Java developers)

    Hey guys! I'm just out looking for some staff for my server. I mostly need Java developers to update a few plugins for me. Snap me if you're interested: daneyboy016

    I'll be more likely to add experienced Java developers to the team.

    Thanks!

    Posted in: Server Recruitment
  • 0

    posted a message on Joypad Mod - USB Controller, Split Screen [over 350K downloads]

    Doesn't work for me. I run it with OptiFine and Shaders, but as soon as I start the game it crashes.

    Posted in: Minecraft Mods
  • To post a comment, please .