Skip to content

Commit

Permalink
1.1.6: Change communication protocol to make uuid switching less conf…
Browse files Browse the repository at this point in the history
…using for Paper
  • Loading branch information
C2D03041 committed Mar 7, 2021
1 parent 54c26bb commit 6f2e4d5
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 64 deletions.
90 changes: 59 additions & 31 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Plugin for Paper/Spigot and Waterfall/Bungeecord that adds player profile slots/
License
---

`profiles-paper-gui`, `profiles-paper-core`, and `profiles-paper-disabler` are distributed under GNU GPL v3
`profiles-paper-gui`, `profiles-paper-core`, and `profiles-paper-disabler` are licensed under GNU GPL v3

`profiles-waterfall` is dual licensed under either GNU GPL v3 or MIT.
`profiles-waterfall` and all other project files are dual licensed under either GNU GPL v3 or MIT.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class ProfilesPaperCoreMessageListener implements PluginMessageListener,
@Inject
ProfilesPaperCorePlugin plugin;

HashSet<Player> suppressDuplicates = new HashSet<>();

@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
//System.out.println("Got message from player uuid channel - "+channel+" - "+player);
Expand Down Expand Up @@ -67,9 +65,4 @@ public void onPluginMessageReceived(String channel, Player player, byte[] messag
Bukkit.getServer().getPluginManager().callEvent(event);
}
}

@EventHandler
public void onPlayerDisconnectEvent(PlayerQuitEvent ev) {
suppressDuplicates.remove(ev.getPlayer());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Injector createInjector() {
protected void configure() {
// Here we tell Guice to use our plugin instance everytime we need it
this.bind(ProfilesPaperCorePlugin.class).toInstance(this.plugin);
bind(ProfilesPaperCoreMessageListener.class);
bind(ProfilesPaperCoreMessageListener.class).in(Singleton.class);
bind(ProfilesPaperCoreSDK.class).in(Singleton.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ public static ProfilesPaperCoreSDK getInstance() {
return plugin.sdk;
}

public boolean switchPlayerToProfile(Player player, UUID genuineUuid, UUID profileUuid) {
public boolean switchPlayerToProfile(Player player, UUID profileUuid) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF( ProfilesConstants.SWITCH_PLAYER_TO_NEW_PROFILE );
out.writeUTF( genuineUuid.toString() );
out.writeUTF( profileUuid.toString() );
player.sendPluginMessage( plugin, ProfilesConstants.BUNGEE_CHANNEL_NAME_FOR_REQUESTS, out.toByteArray() ); // Send to Bungee
return true;
Expand Down
2 changes: 1 addition & 1 deletion profiles-paper-core/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ProfilesPaperCore
version: 1.1.4
version: 1.1.6
main: com.awooga.profiles.ProfilesPaperCorePlugin
api-version: 1.13
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ProfilesPaperDisablerEventListener implements Listener {
public void onUUIDOverrideEvent(PlayerUUIDOverrideEvent ev) {
if(!ev.getCurrentUuid().equals(ev.getOriginalUuid())) {
System.out.println("Got PlayerUUIDOverrideEvent for "+ev.getPlayer().getDisplayName()+" - reconnecting the user on their genuine profile");
sdk.switchPlayerToProfile(ev.getPlayer(), ev.getOriginalUuid(), ev.getOriginalUuid());
sdk.switchPlayerToProfile(ev.getPlayer(), ev.getOriginalUuid());
}

}
Expand Down
2 changes: 1 addition & 1 deletion profiles-paper-disabler/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ProfilesPaperDisabler
version: 1.1.4
version: 1.1.6
main: com.awooga.profiles.ProfilesPaperDisablerPlugin
api-version: 1.13
depend: [ProfilesPaperCore]
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public class ProfilesCommand2 extends BukkitEventFSM<ProfilesCommandState> imple
return s;
}

UUID genuineUuid = playerProfilesDAO.getGenuineUUID(player);
profilesPaperCoreSDK.switchPlayerToProfile(player, genuineUuid, targetUuid);
//UUID genuineUuid = playerProfilesDAO.getGenuineUUID(player);
profilesPaperCoreSDK.switchPlayerToProfile(player, targetUuid);

return s;
})
Expand Down Expand Up @@ -294,7 +294,7 @@ public class ProfilesCommand2 extends BukkitEventFSM<ProfilesCommandState> imple
UUID newUuid = playerProfilesDAO.createNewProfile(player);
playerProfilesDAO.addBrandNewProfileId(newUuid);
UUID genuineUuid = playerProfilesDAO.getGenuineUUID(player);
profilesPaperCoreSDK.switchPlayerToProfile(player, genuineUuid, newUuid);
profilesPaperCoreSDK.switchPlayerToProfile(player, newUuid);
return Triplet.with(true, targetUuid, null);
}

Expand Down
2 changes: 1 addition & 1 deletion profiles-paper-gui/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ProfilesPaperGui
version: 1.1.4
version: 1.1.6
main: com.awooga.profiles.ProfilesPaperGuiPlugin
api-version: 1.13
depend: [PlaceholderAPI, ProfilesPaperCore]
Expand Down
Loading

0 comments on commit 6f2e4d5

Please sign in to comment.