mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Added /copyslot clear (#839)
This commit is contained in:
parent
f01ee3270e
commit
e2661264c1
@ -34,6 +34,12 @@ namespace MCGalaxy.Commands.Building
|
|||||||
OutputCopySlots(p);
|
OutputCopySlots(p);
|
||||||
} else if (message.CaselessEq("random")) {
|
} else if (message.CaselessEq("random")) {
|
||||||
SetRandomCopySlot(p);
|
SetRandomCopySlot(p);
|
||||||
|
} else if (message.CaselessStarts("clear")) {
|
||||||
|
string numStr = message.Substring(5).Trim();
|
||||||
|
int i = 0;
|
||||||
|
if (!CommandParser.GetInt(p, numStr, "Slot number", ref i, 1, p.group.CopySlots)) return;
|
||||||
|
|
||||||
|
ClearCopySlot(p, i);
|
||||||
} else {
|
} else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (!CommandParser.GetInt(p, message, "Slot number", ref i, 1, p.group.CopySlots)) return;
|
if (!CommandParser.GetInt(p, message, "Slot number", ref i, 1, p.group.CopySlots)) return;
|
||||||
@ -84,6 +90,17 @@ namespace MCGalaxy.Commands.Building
|
|||||||
p.Message("Selected copy slot {0}: {1}", i, p.CurrentCopy.Summary);
|
p.Message("Selected copy slot {0}: {1}", i, p.CurrentCopy.Summary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ClearCopySlot(Player p, int i) {
|
||||||
|
int idx = i - 1;
|
||||||
|
List<CopyState> copySlots = p.CopySlots;
|
||||||
|
if (copySlots[idx] == null) {
|
||||||
|
p.Message("Copy slot {0} is already empty.", i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
copySlots[idx] = null;
|
||||||
|
p.Message("Cleared copy slot {0}.", i);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
p.Message("&T/CopySlot random");
|
p.Message("&T/CopySlot random");
|
||||||
@ -91,6 +108,8 @@ namespace MCGalaxy.Commands.Building
|
|||||||
p.Message("&T/CopySlot [number]");
|
p.Message("&T/CopySlot [number]");
|
||||||
p.Message("&HSelects the slot to &T/copy &Hand &T/paste &Hfrom");
|
p.Message("&HSelects the slot to &T/copy &Hand &T/paste &Hfrom");
|
||||||
p.Message("&HMaxmimum number of copy slots is determined by your rank");
|
p.Message("&HMaxmimum number of copy slots is determined by your rank");
|
||||||
|
p.Message("&T/CopySlot clear [number]");
|
||||||
|
p.Message("&HRemoves the copy data from the given slot, making it empty");
|
||||||
p.Message("&T/CopySlot");
|
p.Message("&T/CopySlot");
|
||||||
p.Message("&HLists details about any copies stored in any slots");
|
p.Message("&HLists details about any copies stored in any slots");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user