示例#1
0
        public VanillaCommands.SimpleResponse PlotClaim(Player player)
        {
            PlotCoordinates coords = PlotManager.ConvertToPlotCoordinates(player.KnownPosition);

            if (coords == null)
            {
                return new VanillaCommands.SimpleResponse()
                       {
                           Body = "Not able to claim plot at this position."
                       }
            }
            ;

            Plot plot;

            if (!_plotManager.TryClaim(coords, player, out plot))
            {
                return new VanillaCommands.SimpleResponse()
                       {
                           Body = "Not able to claim plot at this position."
                       }
            }
            ;

            return(new VanillaCommands.SimpleResponse($"Claimed plot {plot.Coordinates.X}:{plot.Coordinates.Z} at {coords}"));
        }
示例#2
0
        public string PlotAuto(Player player)
        {
            BlockCoordinates coords = (BlockCoordinates)player.KnownPosition;

            int x = 0, y = 0, d = 1, m = 1;
            int i = 0;

            while (i++ < 1000)
            {
                while (2 * x * d < m)
                {
                    var current = new PlotCoordinates(x, y);
                    if (_plotManager.TryClaim(current, player, out var plot))
                    {
                        return(ClaimPlot(player, current));
                    }

                    x = x + d;
                }

                while (2 * y * d < m)
                {
                    var current = new PlotCoordinates(x, y);
                    if (_plotManager.TryClaim(current, player, out var plot))
                    {
                        return(ClaimPlot(player, current));
                    }

                    y = y + d;
                }

                d = -1 * d;
                m = m + 1;
            }

            return("Not able to claim plot at this position.");
        }
示例#3
0
        public string PlotClaim(Player player)
        {
            PlotCoordinates coords = (PlotCoordinates)player.KnownPosition;

            if (coords == null)
            {
                return("Not able to claim plot at this position.");
            }

            Plot plot;

            if (!_plotManager.TryClaim(coords, player, out plot))
            {
                return("Not able to claim plot at this position.");
            }

            return($"Claimed plot {plot.Coordinates.X}:{plot.Coordinates.Z} at {coords}");
        }