mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-18 03:39:04 -04:00
GUI: Fix unmute and freeze actions in Players tab not working
This commit is contained in:
parent
26670dcd34
commit
c587387491
@ -19,8 +19,10 @@ using System;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using MCGalaxy.UI;
|
using MCGalaxy.UI;
|
||||||
|
|
||||||
namespace MCGalaxy.Gui {
|
namespace MCGalaxy.Gui
|
||||||
public partial class Window : Form {
|
{
|
||||||
|
public partial class Window : Form
|
||||||
|
{
|
||||||
PlayerProperties playerProps;
|
PlayerProperties playerProps;
|
||||||
|
|
||||||
void NoPlayerSelected() { Popup.Warning("No player selected"); }
|
void NoPlayerSelected() { Popup.Warning("No player selected"); }
|
||||||
@ -68,8 +70,22 @@ namespace MCGalaxy.Gui {
|
|||||||
pl_txtSendCommand.Text = "";
|
pl_txtSendCommand.Text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void pl_BtnMute_Click(object sender, EventArgs e) { DoCmd("mute", "Muted @p"); }
|
void pl_BtnMute_Click(object sender, EventArgs e) {
|
||||||
void pl_BtnFreeze_Click(object sender, EventArgs e){ DoCmd("freeze", "Froze @p"); }
|
if (curPlayer != null && !curPlayer.muted) {
|
||||||
|
DoCmd("mute", "Muted @p");
|
||||||
|
} else {
|
||||||
|
DoCmd("unmute", "Unmuted @p");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void pl_BtnFreeze_Click(object sender, EventArgs e) {
|
||||||
|
if (curPlayer != null && !curPlayer.frozen) {
|
||||||
|
DoCmd("freeze", "Froze @p", "10m");
|
||||||
|
} else {
|
||||||
|
DoCmd("freeze", "Unfroze @p");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void pl_BtnWarn_Click(object sender, EventArgs e) { DoCmd("warn", "Warned @p"); }
|
void pl_BtnWarn_Click(object sender, EventArgs e) { DoCmd("warn", "Warned @p"); }
|
||||||
void pl_BtnKick_Click(object sender, EventArgs e) { DoCmd("kick", "Kicked @p"); }
|
void pl_BtnKick_Click(object sender, EventArgs e) { DoCmd("kick", "Kicked @p"); }
|
||||||
void pl_BtnBan_Click(object sender, EventArgs e) { DoCmd("ban", "Banned @p"); }
|
void pl_BtnBan_Click(object sender, EventArgs e) { DoCmd("ban", "Banned @p"); }
|
||||||
@ -77,9 +93,11 @@ namespace MCGalaxy.Gui {
|
|||||||
void pl_BtnKill_Click(object sender, EventArgs e) { DoCmd("kill", "Killed @p"); }
|
void pl_BtnKill_Click(object sender, EventArgs e) { DoCmd("kill", "Killed @p"); }
|
||||||
void pl_BtnRules_Click(object sender, EventArgs e) { DoCmd("Rules", "Sent rules to @p"); }
|
void pl_BtnRules_Click(object sender, EventArgs e) { DoCmd("Rules", "Sent rules to @p"); }
|
||||||
|
|
||||||
void DoCmd(string cmdName, string action) {
|
void DoCmd(string cmdName, string action, string suffix = null) {
|
||||||
if (curPlayer == null) { NoPlayerSelected(); return; }
|
if (curPlayer == null) { NoPlayerSelected(); return; }
|
||||||
UIHelpers.HandleCommand(cmdName + " " + curPlayer.name);
|
|
||||||
|
string cmd = (cmdName + " " + curPlayer.name + " " + suffix).Trim();
|
||||||
|
UIHelpers.HandleCommand(cmd);
|
||||||
|
|
||||||
Players_AppendStatus(action.Replace("@p", curPlayer.truename));
|
Players_AppendStatus(action.Replace("@p", curPlayer.truename));
|
||||||
Players_UpdateButtons();
|
Players_UpdateButtons();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user