mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Implement /setspawn player, fixes #395
This commit is contained in:
parent
8520799833
commit
79de17943c
@ -14,9 +14,9 @@
|
|||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
namespace MCGalaxy.Commands.World {
|
namespace MCGalaxy.Commands.World {
|
||||||
public sealed class CmdSetspawn : Command {
|
public sealed class CmdSetspawn : Command {
|
||||||
public override string name { get { return "SetSpawn"; } }
|
public override string name { get { return "SetSpawn"; } }
|
||||||
public override string type { get { return CommandTypes.World; } }
|
public override string type { get { return CommandTypes.World; } }
|
||||||
public override bool museumUsable { get { return false; } }
|
public override bool museumUsable { get { return false; } }
|
||||||
@ -24,22 +24,34 @@ namespace MCGalaxy.Commands.World {
|
|||||||
public override bool SuperUseable { get { return false; } }
|
public override bool SuperUseable { get { return false; } }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (message.Length > 0) { Help(p); return; }
|
|
||||||
|
|
||||||
if (!LevelInfo.ValidateAction(p, p.level.name, "set spawn of this level")) return;
|
if (!LevelInfo.ValidateAction(p, p.level.name, "set spawn of this level")) return;
|
||||||
Player.Message(p, "Spawn location set to your current location.");
|
|
||||||
p.level.spawnx = (ushort)p.Pos.BlockX;
|
if (message.Length == 0) {
|
||||||
p.level.spawny = (ushort)p.Pos.BlockY;
|
Player.Message(p, "Spawn location set to your current location.");
|
||||||
p.level.spawnz = (ushort)p.Pos.BlockZ;
|
p.level.spawnx = (ushort)p.Pos.BlockX;
|
||||||
p.level.rotx = p.Rot.RotY;
|
p.level.spawny = (ushort)p.Pos.BlockY;
|
||||||
p.level.roty = p.Rot.HeadX;
|
p.level.spawnz = (ushort)p.Pos.BlockZ;
|
||||||
p.level.Changed = true;
|
p.level.rotx = p.Rot.RotY; p.level.roty = p.Rot.HeadX;
|
||||||
Entities.Spawn(p, p);
|
p.level.Changed = true;
|
||||||
|
Entities.Spawn(p, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player who = PlayerInfo.FindMatches(p, message);
|
||||||
|
if (who == null) return;
|
||||||
|
if (who.level != p.level) { Player.Message(p, "{0} %Sis on a different map.", who.ColoredName); return; }
|
||||||
|
if (p != who && who.Rank >= p.Rank) { MessageTooHighRank(p, "set spawn of", false); return; }
|
||||||
|
|
||||||
|
Player.Message(p, "Set spawn location of {0} %Sto your current location.", who.ColoredName);
|
||||||
|
who.Pos = p.Pos; who.Rot = p.Rot;
|
||||||
|
Entities.Spawn(who, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "%T/SetSpawn");
|
Player.Message(p, "%T/SetSpawn");
|
||||||
Player.Message(p, "%HSets the spawn location of the map to your current location.");
|
Player.Message(p, "%HSets the spawn location of the map to your current location.");
|
||||||
|
Player.Message(p, "%T/SetSpawn [player]");
|
||||||
|
Player.Message(p, "%HSets the spawn location of that player");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,8 +211,6 @@ namespace MCGalaxy {
|
|||||||
public string PreTeleportMap;
|
public string PreTeleportMap;
|
||||||
|
|
||||||
public string summonedMap;
|
public string summonedMap;
|
||||||
public ushort[] pos = new ushort[3];
|
|
||||||
public byte[] rot = new byte[2];
|
|
||||||
internal Position tempPos;
|
internal Position tempPos;
|
||||||
|
|
||||||
// CmdVoteKick
|
// CmdVoteKick
|
||||||
|
@ -85,18 +85,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
if (target.otherRankHidden) return Rank >= target.oHideRank;
|
if (target.otherRankHidden) return Rank >= target.oHideRank;
|
||||||
return Rank >= target.Rank;
|
return Rank >= target.Rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSetPos() {
|
|
||||||
Position p = Pos;
|
|
||||||
pos[0] = (ushort)p.X; pos[1] = (ushort)p.Y; pos[2] = (ushort)p.Z;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnSetRot() {
|
|
||||||
Orientation r = Rot;
|
|
||||||
rot[0] = r.RotY; rot[1] = r.HeadX;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ExtBlock GetHeldBlock() {
|
public ExtBlock GetHeldBlock() {
|
||||||
if (!ModeBlock.IsAir) return ModeBlock;
|
if (!ModeBlock.IsAir) return ModeBlock;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user