Skip to content

Commit

Permalink
GUI: Fix right click on players/levels table being broken
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Jan 17, 2021
1 parent bc5a0be commit 9a37ec1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions GUI/Window/Window.Main.cs
Expand Up @@ -25,8 +25,11 @@ namespace MCGalaxy.Gui {
public partial class Window : Form {

Player GetSelectedPlayer() {
if (main_Players.SelectedRows.Count <= 0) return null;
return (Player)(main_Players.SelectedRows[0].DataBoundItem);
var rows = main_Players.SelectedRows;
if (rows.Count <= 0) return null;

string name = (string)rows[0].Cells[0].Value;
return PlayerInfo.FindExact(name);
}

void PlayerCmd(string command) {
Expand All @@ -52,8 +55,11 @@ public partial class Window : Form {


Level GetSelectedLevel() {
if (main_Maps.SelectedRows.Count <= 0) return null;
return (Level)(main_Maps.SelectedRows[0].DataBoundItem);
var rows = main_Maps.SelectedRows;
if (rows.Count <= 0) return null;

string name = (string)rows[0].Cells[0].Value;
return LevelInfo.FindExact(name);
}

void LevelCmd(string command) {
Expand Down

0 comments on commit 9a37ec1

Please sign in to comment.