Jump to content

Make a SkinSetter mod


Gusta___

Recommended Posts

I recently made a plugin that makes it so if the player has a certain nickname, it is going to be given a skin, and I'd like to know how could I make it a mod, and what are the differences

 

package me.gusta.skinset.utils;



import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;

import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_16_R3.PlayerConnection;

public class SkinSetter {
	
	public static void changeSkin(Player player) {
		
		
		GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
		PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
		
		connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER,
				((CraftPlayer)player).getHandle()));
		
		profile.getProperties().removeAll("textures");
		profile.getProperties().put("textures", getSkin());
		
		connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
				((CraftPlayer)player).getHandle()));
		
	}
	
	private static Property getSkin() {
		
		return new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTYxMTMyNzk3MzMzMSwKICAicHJvZmlsZUlkIiA6ICI3NDM3MGQ1Mjk5Mjk0ZThjODRlYjRlODlhYjc2MGY5MiIsCiAgInByb2ZpbGVOYW1lIiA6ICJQdXRZb3VySmFzT2ZmIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzI0ZGI0ZTUwMDcxNjM2NTlhYWVkMDgyNWM3MTZiODI3MDllMTA1ZjQ0NTg4NzYwODg5ZDBmNTBhOTI3NTU0NjgiCiAgICB9CiAgfQp9", "do8WdtvjtHnGcL25EOG4RX8m8F86UHWRjQU2kDigcTdzF+rRUFyg6IlQFgtgCqsAFBzQi8/YDI8hgEOjM8g3jL6OJ51EixALSeG/LSn4LnzH7pF8TaklK9oxq2bOOYr3D8l/WbcCVcZRMUH1jTqousA3aU4+VL2MW6x7W3FWq9KK3tR3z0cx3ojFQE3bAymp5rUlf84OyM6Or1giyS0RS/tdidcZLo7rDmAXW4cbPhrWvaxzAp52ZQM7GK5z9lyyuCia784ZwEGIGVDxAxAE7tlI07xRYFrHEuJFBPtDodgL1lxiiU1WDUVq9ddxL87EO1RmVYhch/fMS1kiFrwdMuWv82HszLacGdoUuKa6XKEi3TMVLcCSz40JroZIjUOXNqiykrJ0vDnZlEBkJZX8gN0dQlVoedIbXE0rUMtSa2EbEZbC3ZmQjNOteoIwZIBtkZ9RggW9O/oYMwJVA7j7sPTLP2kANmoUXsWt+/6gix4FIf4yJZneDOdkem1p6uKUifcnr4JPfbqmJ66+t4NmZu2AXebTPVt+votM8ERYsS792aFddxNgfcK5tvjcHqW90gbi9wUzmdNEUtvoxICWAVKC1Psa6py7KJoDq5sJgOgQGEPRPNQKQoQxkaYbAfRHvhTNQ3wHlPD/dj+Es3KibGrparLJcfdif1o0Hvtq4IM=");
		
		}
		
	}
package me.gusta.skinset.listeners;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

import me.gusta.skinset.utils.SkinSetter;
import me.gusta.skinset.utils.SkinSetter2;

public class JoinEvent implements Listener {
	
	@EventHandler
	public void onJoin(PlayerJoinEvent event) {
		
		if(event.getPlayer().getDisplayName().equals("Kaoriihhh")) {
			
			SkinSetter.changeSkin(event.getPlayer());
			
		}
		
		if(event.getPlayer().getDisplayName().equals("Gusta___"));
		
		SkinSetter2.changeSkin(event.getPlayer());
		
	}

}

 

Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.