Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #210 from CloudNetService/development
Browse files Browse the repository at this point in the history
Second 2.1.17 Update
  • Loading branch information
byRoadrunner authored Oct 20, 2019
2 parents 3f590d3 + f6d1819 commit 8a225fb
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,46 +306,6 @@ public void handlePost(PostLoginEvent e) {

CloudProxy.getInstance().update();
CloudAPI.getInstance().getNetworkConnection().sendPacket(new PacketOutLoginSuccess(e.getPlayer().getUniqueId()));

if (CloudProxy.getInstance().getProxyGroup().getProxyConfig().isFastConnect()) {
try {

Field channelWrapper;
try {
channelWrapper = UserConnection.class.getDeclaredField("ch");
channelWrapper.setAccessible(true);
} catch (Exception ex) {
channelWrapper = UserConnection.class.getField("ch");
channelWrapper.setAccessible(true);
}

Field field;
try {
field = ChannelWrapper.class.getDeclaredField("ch");
field.setAccessible(true);
} catch (Exception ex) {
field = ChannelWrapper.class.getField("ch");
field.setAccessible(true);
}

Channel channel = (Channel) field.get(channelWrapper.get(e.getPlayer()));
channel.pipeline().addAfter("packet-encoder", "cloudConnection", new MessageToMessageEncoder<DefinedPacket>() {
@Override
protected void encode(ChannelHandlerContext channelHandlerContext, DefinedPacket definedPacket, List<Object> out) throws
Exception {
if (definedPacket instanceof Respawn) {
if (((Respawn) definedPacket).getDimension() != ((UserConnection) e.getPlayer()).getDimension()) {
((Respawn) definedPacket).setDimension(((UserConnection) e.getPlayer()).getDimension());
}
}
out.add(definedPacket);
}
});
} catch (IllegalAccessException | NoSuchFieldException e1) {
e1.printStackTrace();
}
}

}

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public boolean playerRemoveGroup(String world, String player, String group) {
@Override
public String[] getPlayerGroups(String world, String player) {
PermissionEntity permissionEntity = getPlayer(player).getPermissionEntity();
return (String[]) permissionEntity.getGroups().stream().map(GroupEntityData::getGroup).toArray();
return permissionEntity.getGroups().stream().map(GroupEntityData::getGroup).toArray(String[]::new);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public BasicProxyConfig() {
" §bMaintenance §8» §7We are still in §bmaintenance"),
"§8➜ §bMaintenance §8§l【§c✘§8§l】",
1000,
false,
true,
new AutoSlot(0, false),
new TabList(true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class ProxyConfig {

private int maxPlayers;

private boolean fastConnect;

private Boolean customPayloadFixer;

private AutoSlot autoSlot;
Expand All @@ -41,7 +39,6 @@ public ProxyConfig(boolean enabled,
Motd maintenanceMotdLayout,
String maintenaceProtocol,
int maxPlayers,
boolean fastConnect,
Boolean customPayloadFixer,
AutoSlot autoSlot,
TabList tabList,
Expand All @@ -54,7 +51,6 @@ public ProxyConfig(boolean enabled,
this.maintenanceMotdLayout = maintenanceMotdLayout;
this.maintenaceProtocol = maintenaceProtocol;
this.maxPlayers = maxPlayers;
this.fastConnect = fastConnect;
this.customPayloadFixer = customPayloadFixer;
this.autoSlot = autoSlot;
this.tabList = tabList;
Expand Down Expand Up @@ -159,11 +155,4 @@ public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public boolean isFastConnect() {
return fastConnect;
}

public void setFastConnect(boolean fastConnect) {
this.fastConnect = fastConnect;
}
}

0 comments on commit 8a225fb

Please sign in to comment.