Skip to content

Commit

Permalink
Removed haspaid support (Thanks.... mojang...)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonty800 committed Nov 11, 2012
1 parent 68baedb commit 12ed488
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 78 deletions.
3 changes: 0 additions & 3 deletions ConfigGUI/MainForm.Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ void ApplyTabSecurity() {
cPatrolledRank.SelectedIndex = RankManager.GetIndex( RankManager.PatrolledRank );
}

xPaidPlayersOnly.Checked = ConfigKey.PaidPlayersOnly.Enabled();


xBlockDBEnabled.Checked = ConfigKey.BlockDBEnabled.Enabled();
xBlockDBAutoEnable.Checked = ConfigKey.BlockDBAutoEnable.Enabled();
Expand Down Expand Up @@ -535,7 +533,6 @@ void SaveConfig() {
} else {
ConfigKey.PatrolledRank.TrySetValue( RankManager.PatrolledRank.FullName );
}
ConfigKey.PaidPlayersOnly.TrySetValue( xPaidPlayersOnly.Checked );

ConfigKey.BlockDBEnabled.TrySetValue( xBlockDBEnabled.Checked );
ConfigKey.BlockDBAutoEnable.TrySetValue( xBlockDBAutoEnable.Checked );
Expand Down
56 changes: 21 additions & 35 deletions ConfigGUI/MainForm.Designer.cs

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

2 changes: 0 additions & 2 deletions ConfigGUI/MainForm.ToolTips.cs
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,6 @@ void FillToolTipsSecurity() {
toolTip.SetToolTip( nAntispamMaxWarnings, ConfigKey.AntispamMaxWarnings.GetDescription() );
toolTip.SetToolTip( lAntispamMaxWarnings, ConfigKey.AntispamMaxWarnings.GetDescription() );

toolTip.SetToolTip( xPaidPlayersOnly, ConfigKey.PaidPlayersOnly.GetDescription() );

toolTip.SetToolTip( xBlockDBEnabled, ConfigKey.BlockDBEnabled.GetDescription() );
toolTip.SetToolTip( xBlockDBAutoEnable, ConfigKey.BlockDBAutoEnable.GetDescription() );
toolTip.SetToolTip( cBlockDBAutoEnableRank, ConfigKey.BlockDBAutoEnableRank.GetDescription() );
Expand Down
7 changes: 0 additions & 7 deletions fCraft/Network/Player.Networking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,13 +694,6 @@ bool LoginSequence() {
ConfigKey.ServerName.GetString(),
"Please wait; Checking paid status..." ) );
writer.Flush();

if( !CheckPaidStatus( Name ) ) {
Logger.Log( LogType.SystemActivity,
"Player {0} was kicked because their account is not paid, and PaidPlayersOnly setting is enabled.", Name );
KickNow( "Paid players allowed only.", LeaveReason.LoginFailed );
return false;
}
}


Expand Down
31 changes: 0 additions & 31 deletions fCraft/Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,37 +1600,6 @@ public bool StopPossessing ( [NotNull]Player target ) {

#region Static Utilities

static readonly Uri PaidCheckUri = new Uri( "http://minecraft.net/haspaid.jsp?user=" );
const int PaidCheckTimeout = 5000;


/// <summary> Checks whether a given player has a paid minecraft.net account. </summary>
/// <returns> True if the account is paid. False if it is not paid, or if information is unavailable. </returns>
public static bool CheckPaidStatus ( [NotNull] string name ) {
if ( name == null ) throw new ArgumentNullException( "name" );
HttpWebRequest request = ( HttpWebRequest )WebRequest.Create( PaidCheckUri + Uri.EscapeDataString( name ) );
request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint( Server.BindIPEndPointCallback );
request.Timeout = PaidCheckTimeout;
request.CachePolicy = new RequestCachePolicy( RequestCacheLevel.NoCacheNoStore );

try {
using ( WebResponse response = request.GetResponse() ) {
// ReSharper disable AssignNullToNotNullAttribute
using ( StreamReader responseReader = new StreamReader( response.GetResponseStream() ) ) {
// ReSharper restore AssignNullToNotNullAttribute
string paidStatusString = responseReader.ReadToEnd();
bool isPaid;
return Boolean.TryParse( paidStatusString, out isPaid ) && isPaid;
}
}
} catch ( WebException ex ) {
Logger.Log( LogType.Warning,
"Could not check paid status of player {0}: {1}",
name, ex.Message );
return false;
}
}


/// <summary> Ensures that a player name has the correct length and character set. </summary>
public static bool IsValidName ( [NotNull] string name ) {
Expand Down

0 comments on commit 12ed488

Please sign in to comment.