-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from ORelio/Indev
Merging changes from Indev for 1.8.2 release
- Loading branch information
Showing
17 changed files
with
360 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/MinecraftClient.suo | ||
/MinecraftClientGUI.v11.suo | ||
/MinecraftClientGUI.suo | ||
/MinecraftClient.userprefs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Threading; | ||
|
||
namespace MinecraftClient | ||
{ | ||
/// <summary> | ||
/// Allow easy timeout on pieces of code | ||
/// </summary> | ||
/// <remarks> | ||
/// By ORelio - (c) 2014 - CDDL 1.0 | ||
/// </remarks> | ||
public class AutoTimeout | ||
{ | ||
/// <summary> | ||
/// Perform the specified action with specified timeout | ||
/// </summary> | ||
/// <param name="action">Action to run</param> | ||
/// <param name="timeout">Maximum timeout in milliseconds</param> | ||
/// <returns>True if the action finished whithout timing out</returns> | ||
public static bool Perform(Action action, int timeout) | ||
{ | ||
return Perform(action, TimeSpan.FromMilliseconds(timeout)); | ||
} | ||
|
||
/// <summary> | ||
/// Perform the specified action with specified timeout | ||
/// </summary> | ||
/// <param name="action">Action to run</param> | ||
/// <param name="timeout">Maximum timeout</param> | ||
/// <returns>True if the action finished whithout timing out</returns> | ||
public static bool Perform(Action action, TimeSpan timeout) | ||
{ | ||
Thread thread = new Thread(new ThreadStart(action)); | ||
thread.Start(); | ||
bool success = thread.Join(timeout); | ||
if (!success) | ||
thread.Abort(); | ||
return success; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace MinecraftClient.Commands | ||
{ | ||
public class List : Command | ||
{ | ||
public override string CMDName { get { return "list"; } } | ||
public override string CMDDesc { get { return "list: get the player list."; } } | ||
|
||
public override string Run(McTcpClient handler, string command) | ||
{ | ||
return "PlayerList: " + String.Join(", ", handler.getOnlinePlayers()); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.