コード例 #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}");
        }
コード例 #2
0
        private string ClaimPlot(Player player, PlotCoordinates coords)
        {
            var bbox   = PlotManager.GetBoundingBoxForPlot(coords);
            var center = bbox.Max - (bbox.Max - bbox.Min) / 2;
            int height = player.Level.GetHeight(center);

            player.Teleport(new PlayerLocation(center.X, height + 3, center.Z));

            return($"Claimed plot {coords.X},{coords.Z}");
        }
コード例 #3
0
        public string PlotVisit(Player player, int x, int z)
        {
            PlotCoordinates coords = new PlotCoordinates(x, z);

            if (x == 0 || z == 0)
            {
                return($"No plot at this location {coords.X},{coords.Z}.");
            }

            var bbox   = PlotManager.GetBoundingBoxForPlot(coords);
            var center = bbox.Max - (bbox.Max - bbox.Min) / 2;
            int height = player.Level.GetHeight(center);

            player.Teleport(new PlayerLocation(center.X, height + 3, center.Z));

            return($"Moved you to plot {coords.X},{coords.Z}.");
        }
コード例 #4
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}.");
        }
コード例 #5
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}.");
        }