Skip to content

Commit

Permalink
Fixed instant updates for BungeeCord servers
Browse files Browse the repository at this point in the history
(users don't see the new skin)
  • Loading branch information
games647 committed Jun 10, 2016
1 parent 3d5b3a9 commit 3859f51
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#Changelog

##### 1.4.1

* Fixed instant updates for BungeeCord servers

##### 1.4

* Added skin cooldown
Expand Down
2 changes: 1 addition & 1 deletion bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>changeskin</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package com.github.games647.changeskin.bukkit.listener;

import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
import com.github.games647.changeskin.bukkit.ChangeSkinBukkit;
import com.github.games647.changeskin.bukkit.tasks.SkinUpdater;
import com.github.games647.changeskin.core.ChangeSkinCore;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
Expand All @@ -21,8 +26,16 @@ public void onPluginMessageReceived(String channel, Player player, byte[] messag
return;
}

// ByteArrayDataInput dataInput = ByteStreams.newDataInput(message);
// String subchannel = dataInput.readUTF();
ByteArrayDataInput dataInput = ByteStreams.newDataInput(message);
String subchannel = dataInput.readUTF();

WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player);
//remove existing skins
gameProfile.getProperties().clear();
WrappedSignedProperty property = WrappedSignedProperty
.fromValues(ChangeSkinCore.SKIN_KEY, dataInput.readUTF(), dataInput.readUTF());
gameProfile.getProperties().put(ChangeSkinCore.SKIN_KEY, property);

Bukkit.getScheduler().runTask(plugin, new SkinUpdater(plugin, null, player));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public void run() {
}

WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(receiver);

if (plugin.getStorage() != null) {
UserPreferences preferences = plugin.getStorage().getPreferences(receiver.getUniqueId(), false);
SkinData targetSkin = preferences.getTargetSkin();
Expand Down
2 changes: 1 addition & 1 deletion bungee/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>changeskin</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;

import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
Expand Down Expand Up @@ -124,7 +124,9 @@ public void applySkin(ProxiedPlayer player, SkinData skinData) {
if (player.getServer() != null) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("UpdateSkin");
player.getServer().sendData(this.getDescription().getName(), out.toByteArray());
out.writeUTF(skinData.getEncodedData());
out.writeUTF(skinData.getEncodedSignature());
player.getServer().sendData(getDescription().getName(), out.toByteArray());
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>changeskin</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<packaging>pom</packaging>

<name>ChangeSkin</name>
<version>1.4</version>
<version>1.4.1</version>
<inceptionYear>2015</inceptionYear>
<url>http://dev.bukkit.org/bukkit-plugins/changeskin/</url>
<description>
Expand Down
2 changes: 1 addition & 1 deletion universal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>changeskin</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit 3859f51

Please sign in to comment.