generated from TobiasDeBruijn/BaseBukkitPlugin
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TheDutchMC
committed
Nov 7, 2020
1 parent
449dc32
commit a837641
Showing
6 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apply plugin: 'java' | ||
dependencies { | ||
compileOnly 'org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT' | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
.../java/nl/thedutchmc/SkinFixer/changeSkin/changeGameProfile/ChangeGameProfile_1_16_r3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package nl.thedutchmc.SkinFixer.changeSkin.changeGameProfile; | ||
|
||
import java.util.UUID; | ||
|
||
import org.bukkit.Bukkit; | ||
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 com.mojang.authlib.properties.PropertyMap; | ||
|
||
import net.minecraft.server.v1_16_R3.EntityPlayer; | ||
import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo; | ||
import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; | ||
|
||
public class ChangeGameProfile_1_16_r3 { | ||
|
||
public static void changeProfile(UUID uuid, String skinValue, String skinSignature) { | ||
Player player = Bukkit.getPlayer(uuid); | ||
|
||
//Fetch the EntityPlayer and their GameProfile | ||
EntityPlayer ep = ((CraftPlayer)player).getHandle(); | ||
GameProfile gp = ep.getProfile(); | ||
|
||
//Get the skin texture property | ||
PropertyMap pm = gp.getProperties(); | ||
|
||
//Check if the propertyMap contains a texture value, if so, remove it. | ||
if(pm.containsKey("textures")) { | ||
Property property = pm.get("textures").iterator().next(); | ||
pm.remove("textures", property); | ||
} | ||
|
||
//Remove the old texture, and set the new one. | ||
pm.put("textures", new Property("textures", skinValue, skinSignature)); | ||
|
||
//Reload the skin for the player itself | ||
reloadSkinForSelf(player); | ||
} | ||
|
||
public static void reloadSkinForSelf(Player player) { | ||
final EntityPlayer ep = ((CraftPlayer) player).getHandle(); | ||
final PacketPlayOutPlayerInfo removeInfo = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, ep); | ||
final PacketPlayOutPlayerInfo addInfo = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, ep); | ||
|
||
ep.playerConnection.sendPacket(removeInfo); | ||
ep.playerConnection.sendPacket(addInfo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
rootProject.name = pluginName | ||
include ':Spigot_1_16_R1' | ||
include ':Spigot_1_16_R2' | ||
include ':Spigot_1_16_R2' | ||
include ':Spigot_1_16_R3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters