Esempio n. 1
0
        public string PlotSetBiome(Player player, int biomeId = 1)
        {
            PlotCoordinates coords = (PlotCoordinates)player.KnownPosition;

            if (!_plotManager.HasClaim(coords, player))
            {
                return("You don't own this plot.");
            }
            if (!_plotManager.TryGetPlot(coords, out Plot plot))
            {
                return("No plot found.");
            }

            var bbox = PlotManager.GetBoundingBoxForPlot(plot.Coordinates);

            PlotWorldGenerator.SetBiome(player.Level, bbox, (byte)biomeId);

            Task.Run(() =>
            {
                player.CleanCache();
                player.ForcedSendChunks(() => { player.SendMessage($"Resent chunks."); });
            });

            return($"Set biome on plot {plot.Coordinates} to {biomeId}");
        }
Esempio n. 2
0
        public static PlotCoordinates ConvertToPlotCoordinates(BlockCoordinates coords)
        {
            if (PlotWorldGenerator.IsXRoad(coords.X, true) || PlotWorldGenerator.IsZRoad(coords.Z, true))
            {
                return(null);
            }

            int plotX = coords.X / PlotWorldGenerator.PlotAreaWidth + (Math.Sign(coords.X));
            int plotZ = coords.Z / PlotWorldGenerator.PlotAreaDepth + (Math.Sign(coords.Z));

            return(new PlotCoordinates(plotX, plotZ));
        }
Esempio n. 3
0
        public string PlotAuto(Player player)
        {
            BlockCoordinates coords = (BlockCoordinates)player.KnownPosition;

            if (PlotWorldGenerator.IsXRoad(coords.X, true) || PlotWorldGenerator.IsZRoad(coords.Z, true))
            {
                return("Not able to claim plot at this position.");
            }

            int plotX = coords.X / PlotWorldGenerator.PlotAreaWidth + Math.Sign(coords.X);
            int plotZ = coords.Z / PlotWorldGenerator.PlotAreaDepth + Math.Sign(coords.Z);

            return($"Claimed plot {plotX}:{plotZ} at {coords}");
        }
Esempio n. 4
0
        public VanillaCommands.SimpleResponse PlotAuto(Player player)
        {
            BlockCoordinates coords = (BlockCoordinates)player.KnownPosition;

            if (PlotWorldGenerator.IsXRoad(coords.X, true) || PlotWorldGenerator.IsZRoad(coords.Z, true))
            {
                return new VanillaCommands.SimpleResponse()
                       {
                           Body = "Not able to claim plot at this position."
                       }
            }
            ;

            int plotX = coords.X / PlotWorldGenerator.PlotAreaWidth + Math.Sign(coords.X);
            int plotZ = coords.Z / PlotWorldGenerator.PlotAreaDepth + Math.Sign(coords.Z);

            return(new VanillaCommands.SimpleResponse($"Claimed plot {plotX}:{plotZ} at {coords}"));
        }
Esempio n. 5
0
        public string PlotDelete(Player player, bool force = false)
        {
            PlotCoordinates coords = (PlotCoordinates)player.KnownPosition;

            if (!force && !_plotManager.HasClaim(coords, player))
            {
                return("Not able to reset plot at this position.");
            }
            if (!_plotManager.TryGetPlot(coords, out Plot plot) && !force)
            {
                return("Not able to delete plot at this position.");
            }
            if (plot != null && !_plotManager.Delete(plot))
            {
                return("Not able to delete plot at this position.");
            }

            PlotWorldGenerator.ResetBlocks(player.Level, PlotManager.GetBoundingBoxForPlot(coords), true);

            return($"Deleted plot {coords.X},{coords.Z}.");
        }
Esempio n. 6
0
        public string PlotClear(Player player)
        {
            PlotCoordinates coords = (PlotCoordinates)player.KnownPosition;

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

            if (!_plotManager.HasClaim(coords, player))
            {
                return("Not able to reset plot at this position.");
            }
            if (!_plotManager.TryGetPlot(coords, out Plot plot))
            {
                return("Not able to reset plot at this position.");
            }

            PlotWorldGenerator.ResetBlocks(player.Level, PlotManager.GetBoundingBoxForPlot(plot.Coordinates));

            return($"Reset plot {plot.Coordinates.X},{plot.Coordinates.Z}.");
        }