From a2b3d8825edc8c5162019b2ae0a80005cffa7c04 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sun, 13 Nov 2016 22:59:32 +1100 Subject: [PATCH] Add 'xmage.de', 'woogerworks', 'localhost' buttons to connection dialog to fill in appropriate password/username --- .../mage/client/dialog/ConnectDialog.form | 91 ++++++++++++-- .../mage/client/dialog/ConnectDialog.java | 112 ++++++++++++++++-- .../main/java/mage/server/ChatManager.java | 2 +- 3 files changed, 182 insertions(+), 23 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form index 8d7227bc5f..a46c8a317a 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.form @@ -26,7 +26,7 @@ - + @@ -38,23 +38,32 @@ - + + + - - - + + + + + + + + + + + + - - + + - - @@ -72,7 +81,7 @@ - + @@ -89,6 +98,9 @@ + + + @@ -111,7 +123,7 @@ - + @@ -255,5 +267,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index 6436e0172b..0c4b5dd9ec 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -166,6 +166,9 @@ public class ConnectDialog extends MageDialog { lblStatus = new javax.swing.JLabel(); btnRegister = new javax.swing.JButton(); btnForgotPassword = new javax.swing.JButton(); + btnFind1 = new javax.swing.JButton(); + btnFind2 = new javax.swing.JButton(); + btnFind3 = new javax.swing.JButton(); setTitle("Connect to server"); setNormalBounds(new java.awt.Rectangle(100, 100, 410, 307)); @@ -255,6 +258,50 @@ public class ConnectDialog extends MageDialog { } }); + btnFind1.setText("X"); + btnFind1.setToolTipText("Connect to xmage.de"); + btnFind1.setActionCommand("connectXmageDe"); + btnFind1.setAlignmentY(0.0F); + btnFind1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + btnFind1.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); + btnFind1.setMaximumSize(new java.awt.Dimension(42, 23)); + btnFind1.setMinimumSize(new java.awt.Dimension(42, 23)); + btnFind1.setName("connectXmageDeBtn"); // NOI18N + btnFind1.setPreferredSize(new java.awt.Dimension(23, 23)); + btnFind1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + connectXmageDe(evt); + } + }); + + btnFind2.setText("L"); + btnFind2.setToolTipText("Connect to localhost"); + btnFind2.setActionCommand("connectLocalhost"); + btnFind2.setAlignmentY(0.0F); + btnFind2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + btnFind2.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); + btnFind2.setName("connectLocalhostBtn"); // NOI18N + btnFind2.setPreferredSize(new java.awt.Dimension(23, 23)); + btnFind2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + connectLocalhost(evt); + } + }); + + btnFind3.setText("W"); + btnFind3.setToolTipText("Connect to woogerworks"); + btnFind3.setActionCommand("connectWoogerworks"); + btnFind3.setAlignmentY(0.0F); + btnFind3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + btnFind3.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); + btnFind3.setName("connectWoogerworksBtn"); // NOI18N + btnFind3.setPreferredSize(new java.awt.Dimension(23, 23)); + btnFind3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + connectWoogerworks(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -273,18 +320,26 @@ public class ConnectDialog extends MageDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE) .addComponent(jProxySettingsButton) .addComponent(cbFlag, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(txtServer, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE) - .addComponent(txtPort, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(txtUserName) - .addComponent(txtPassword)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnFind)) - .addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(txtServer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE) + .addComponent(txtUserName, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(txtPassword, javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnFind1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnFind3, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnFind2, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(69, 69, 69))) + .addGap(8, 8, 8) + .addComponent(btnFind, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) @@ -309,7 +364,10 @@ public class ConnectDialog extends MageDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lblPort)) + .addComponent(lblPort) + .addComponent(btnFind1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnFind2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnFind3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -328,7 +386,7 @@ public class ConnectDialog extends MageDialog { .addComponent(chkForceUpdateDB) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jProxySettingsButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 47, Short.MAX_VALUE) .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -596,6 +654,35 @@ public class ConnectDialog extends MageDialog { resetPasswordDialog.showDialog(); }//GEN-LAST:event_btnForgotPasswordActionPerformed + private void connectXmageDe(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFind1findPublicServerActionPerformed + String serverAddress = "xmage.de"; + this.txtServer.setText(serverAddress); + this.txtPort.setText("17171"); + // Update userName and password according to the chosen server. + this.txtUserName.setText(MagePreferences.getUserName(serverAddress)); + this.txtPassword.setText(MagePreferences.getPassword(serverAddress)); + + }//GEN-LAST:event_btnFind1findPublicServerActionPerformed + + private void connectLocalhost(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFind2findPublicServerActionPerformed + String serverAddress = "localhost"; + this.txtServer.setText(serverAddress); + this.txtPort.setText("17171"); + // Update userName and password according to the chosen server. + this.txtUserName.setText(MagePreferences.getUserName(serverAddress)); + this.txtPassword.setText(MagePreferences.getPassword(serverAddress)); + + }//GEN-LAST:event_btnFind2findPublicServerActionPerformed + + private void connectWoogerworks(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectWoogerworks + String serverAddress = "xmage.woogerworks.com"; + this.txtServer.setText(serverAddress); + this.txtPort.setText("17171"); + // Update userName and password according to the chosen server. + this.txtUserName.setText(MagePreferences.getUserName(serverAddress)); + this.txtPassword.setText(MagePreferences.getPassword(serverAddress)); + }//GEN-LAST:event_connectWoogerworks + public String getServer() { return this.txtServer.getText(); } @@ -608,6 +695,9 @@ public class ConnectDialog extends MageDialog { private javax.swing.JButton btnCancel; private javax.swing.JButton btnConnect; private javax.swing.JButton btnFind; + private javax.swing.JButton btnFind1; + private javax.swing.JButton btnFind2; + private javax.swing.JButton btnFind3; private javax.swing.JButton btnForgotPassword; private javax.swing.JButton btnRegister; private mage.client.util.gui.countryBox.CountryComboBox cbFlag; diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index ac0e7a6821..98208801ab 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -107,7 +107,7 @@ public class ChatManager { } private boolean containsSwearing(String message) { - if (message != null && message.toLowerCase().matches("^.*(asshole|balls|bastard|bitch|blowjob|cock|crap|cunt|damn|dick|douche|fag|fuck|idiot|moron|piss|prick|pussy|rape|rapist|screw you|shit|slut|vagina).*$")) { + if (message != null && message.toLowerCase().matches("^.*(anal|asshole|balls|bastard|bitch|blowjob|cock|crap|cunt|damn|dick|douche|fag|fuck|idiot|moron|piss|prick|pussy|rape|rapist|sex|screw you|shit|slut|vagina).*$")) { return true; } return false;