mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2025-01-26 22:11:30 +01:00
Cleaned code
This commit is contained in:
parent
512ce30ffe
commit
f2d413577e
@ -18,7 +18,7 @@
|
|||||||
package java.lang;
|
package java.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy class to make IntelliJ able to access records in Java 8 code
|
* Dummy class to make IntelliJ able to access records in Java 8 code.
|
||||||
*/
|
*/
|
||||||
public abstract class Record {
|
public abstract class Record {
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ public abstract class MixinAbstractFenceConnectionHandler {
|
|||||||
public byte getStates(UserConnection user, Position position, int blockState) {
|
public byte getStates(UserConnection user, Position position, int blockState) {
|
||||||
byte states = 0;
|
byte states = 0;
|
||||||
boolean pre1_12 = VersionEnum.fromUserConnection(user).isOlderThan(VersionEnum.r1_12);
|
boolean pre1_12 = VersionEnum.fromUserConnection(user).isOlderThan(VersionEnum.r1_12);
|
||||||
if (connects(BlockFace.EAST, getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1;
|
if (this.connects(BlockFace.EAST, this.getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1;
|
||||||
if (connects(BlockFace.NORTH, getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2;
|
if (this.connects(BlockFace.NORTH, this.getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2;
|
||||||
if (connects(BlockFace.SOUTH, getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4;
|
if (this.connects(BlockFace.SOUTH, this.getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4;
|
||||||
if (connects(BlockFace.WEST, getBlockData(user, position.getRelative(BlockFace.WEST)), pre1_12)) states |= 8;
|
if (this.connects(BlockFace.WEST, this.getBlockData(user, position.getRelative(BlockFace.WEST)), pre1_12)) states |= 8;
|
||||||
return states;
|
return states;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import io.netty.channel.ChannelHandler;
|
|||||||
public class Client2ProxyHandlerCreationEvent {
|
public class Client2ProxyHandlerCreationEvent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The handler which will be used to handle Client<->Proxy packets
|
* The handler which will be used to handle Client<->Proxy packets.
|
||||||
*/
|
*/
|
||||||
private ChannelHandler handler;
|
private ChannelHandler handler;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import io.netty.channel.ChannelHandler;
|
|||||||
public class Proxy2ServerHandlerCreationEvent {
|
public class Proxy2ServerHandlerCreationEvent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The handler which will be used to handle Proxy<->Server packets
|
* The handler which will be used to handle Proxy<->Server packets.
|
||||||
*/
|
*/
|
||||||
private ChannelHandler handler;
|
private ChannelHandler handler;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class ResolveSrvEvent extends EventCancellable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return host;
|
return this.host;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHost(final String host) {
|
public void setHost(final String host) {
|
||||||
@ -45,7 +45,7 @@ public class ResolveSrvEvent extends EventCancellable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPort() {
|
public int getPort() {
|
||||||
return port;
|
return this.port;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPort(final int port) {
|
public void setPort(final int port) {
|
||||||
|
@ -31,7 +31,7 @@ public class ViaProxyTransferProvider extends TransferProvider {
|
|||||||
public void connectToServer(UserConnection user, InetSocketAddress newAddress) {
|
public void connectToServer(UserConnection user, InetSocketAddress newAddress) {
|
||||||
ViaBedrockTransferHolder.addTempRedirect(user.getChannel(), newAddress);
|
ViaBedrockTransferHolder.addTempRedirect(user.getChannel(), newAddress);
|
||||||
try {
|
try {
|
||||||
ProxyConnection.fromUserConnection(user).kickClient("§aThe server transferred you to another server §7(§e"+ newAddress.getHostName() + ":" + newAddress.getPort() + "§7)§a. Please reconnect to ViaProxy.");
|
ProxyConnection.fromUserConnection(user).kickClient("§aThe server transferred you to another server §7(§e" + newAddress.getHostName() + ":" + newAddress.getPort() + "§7)§a. Please reconnect to ViaProxy.");
|
||||||
} catch (CloseAndReturn ignored) {
|
} catch (CloseAndReturn ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,11 +295,11 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler<IPacket> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyConnection.setLoginHelloPacket(packet);
|
this.proxyConnection.setLoginHelloPacket(packet);
|
||||||
if (packet instanceof C2SLoginHelloPacket1_19_3) {
|
if (packet instanceof C2SLoginHelloPacket1_19_3) {
|
||||||
proxyConnection.setGameProfile(new GameProfile(((C2SLoginHelloPacket1_19_3) packet).uuid, packet.name));
|
this.proxyConnection.setGameProfile(new GameProfile(((C2SLoginHelloPacket1_19_3) packet).uuid, packet.name));
|
||||||
} else {
|
} else {
|
||||||
proxyConnection.setGameProfile(new GameProfile(null, packet.name));
|
this.proxyConnection.setGameProfile(new GameProfile(null, packet.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.ONLINE_MODE) {
|
if (Options.ONLINE_MODE) {
|
||||||
|
@ -79,7 +79,7 @@ public class UpdateCheckTask implements Runnable {
|
|||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (JsonElement asset : assets) {
|
for (JsonElement asset : assets) {
|
||||||
JsonObject assetObject = asset.getAsJsonObject();
|
JsonObject assetObject = asset.getAsJsonObject();
|
||||||
if (isViaProxyJar(object, assetObject)) {
|
if (this.isViaProxyJar(object, assetObject)) {
|
||||||
found = true;
|
found = true;
|
||||||
SwingUtilities.invokeLater(() -> this.showUpdateQuestion(assetObject.get("name").getAsString(), assetObject.get("browser_download_url").getAsString(), latestVersion));
|
SwingUtilities.invokeLater(() -> this.showUpdateQuestion(assetObject.get("name").getAsString(), assetObject.get("browser_download_url").getAsString(), latestVersion));
|
||||||
break;
|
break;
|
||||||
|
@ -82,7 +82,7 @@ public class ViaProxyUI extends JFrame {
|
|||||||
this.addWindowListener(new WindowAdapter() {
|
this.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
for (AUITab tab : tabs) tab.onClose();
|
for (AUITab tab : ViaProxyUI.this.tabs) tab.onClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.setSize(500, 353);
|
this.setSize(500, 353);
|
||||||
|
@ -94,24 +94,24 @@ public class AccountsTab extends AUITab {
|
|||||||
this.accountsList.addMouseListener(new MouseAdapter() {
|
this.accountsList.addMouseListener(new MouseAdapter() {
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if (SwingUtilities.isRightMouseButton(e)) {
|
if (SwingUtilities.isRightMouseButton(e)) {
|
||||||
int row = accountsList.locationToIndex(e.getPoint());
|
int row = AccountsTab.this.accountsList.locationToIndex(e.getPoint());
|
||||||
accountsList.setSelectedIndex(row);
|
AccountsTab.this.accountsList.setSelectedIndex(row);
|
||||||
} else if (e.getClickCount() == 2) {
|
} else if (e.getClickCount() == 2) {
|
||||||
int index = accountsList.getSelectedIndex();
|
int index = AccountsTab.this.accountsList.getSelectedIndex();
|
||||||
if (index != -1) markSelected(index);
|
if (index != -1) AccountsTab.this.markSelected(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.accountsList.addKeyListener(new KeyAdapter() {
|
this.accountsList.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
int index = accountsList.getSelectedIndex();
|
int index = AccountsTab.this.accountsList.getSelectedIndex();
|
||||||
if (index == -1) return;
|
if (index == -1) return;
|
||||||
if (e.getKeyCode() == KeyEvent.VK_UP) {
|
if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||||
moveUp(index);
|
AccountsTab.this.moveUp(index);
|
||||||
e.consume();
|
e.consume();
|
||||||
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||||
moveDown(index);
|
AccountsTab.this.moveDown(index);
|
||||||
e.consume();
|
e.consume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ public class AccountsTab extends AUITab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Options.MC_ACCOUNT = ViaProxy.saveManager.accountsSave.getAccounts().get(index);
|
Options.MC_ACCOUNT = ViaProxy.saveManager.accountsSave.getAccounts().get(index);
|
||||||
accountsList.repaint();
|
this.accountsList.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveUp(final int index) {
|
private void moveUp(final int index) {
|
||||||
|
@ -51,7 +51,7 @@ public class AddAccountPopup extends JDialog {
|
|||||||
this.addWindowListener(new WindowAdapter() {
|
this.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
if (!externalClose) closeListener.run();
|
if (!AddAccountPopup.this.externalClose) closeListener.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.setTitle("Add Account");
|
this.setTitle("Add Account");
|
||||||
@ -74,7 +74,7 @@ public class AddAccountPopup extends JDialog {
|
|||||||
urlLabel.addMouseListener(new MouseAdapter() {
|
urlLabel.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent e) {
|
public void mouseReleased(MouseEvent e) {
|
||||||
parent.openURL(deviceCode.verificationUri());
|
AddAccountPopup.this.parent.openURL(AddAccountPopup.this.deviceCode.verificationUri());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
contentPane.add(urlLabel);
|
contentPane.add(urlLabel);
|
||||||
|
Loading…
Reference in New Issue
Block a user