mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-31 01:23:44 +01:00 
			
		
		
		
	Allow debugroadregen to regenerate plot roads
This commit is contained in:
		| @@ -22,11 +22,14 @@ package com.intellectualcrafters.plot.commands; | |||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
|  | import com.intellectualcrafters.plot.generator.HybridPlotManager; | ||||||
| import com.intellectualcrafters.plot.generator.HybridPlotWorld; | import com.intellectualcrafters.plot.generator.HybridPlotWorld; | ||||||
| import com.intellectualcrafters.plot.generator.HybridUtils; | import com.intellectualcrafters.plot.generator.HybridUtils; | ||||||
| import com.intellectualcrafters.plot.object.ChunkLoc; | import com.intellectualcrafters.plot.object.ChunkLoc; | ||||||
| import com.intellectualcrafters.plot.object.Location; | import com.intellectualcrafters.plot.object.Location; | ||||||
|  | import com.intellectualcrafters.plot.object.Plot; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
|  | import com.intellectualcrafters.plot.object.PlotWorld; | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
| import com.plotsquared.general.commands.CommandDeclaration; | import com.plotsquared.general.commands.CommandDeclaration; | ||||||
|  |  | ||||||
| @@ -44,12 +47,26 @@ public class DebugRoadRegen extends SubCommand { | |||||||
|     public boolean onCommand(final PlotPlayer player, final String ... args) { |     public boolean onCommand(final PlotPlayer player, final String ... args) { | ||||||
|         final Location loc = player.getLocation(); |         final Location loc = player.getLocation(); | ||||||
|         final String world = loc.getWorld(); |         final String world = loc.getWorld(); | ||||||
|         if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) { |         PlotWorld plotworld = PS.get().getPlotWorld(world); | ||||||
|  |         if (!(plotworld instanceof HybridPlotWorld)) { | ||||||
|             return sendMessage(player, C.NOT_IN_PLOT_WORLD); |             return sendMessage(player, C.NOT_IN_PLOT_WORLD); | ||||||
|         } |         } | ||||||
|         final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); |         Plot plot = player.getCurrentPlot(); | ||||||
|         final boolean result = HybridUtils.manager.regenerateRoad(world, chunk, 0); |         if (plot == null) { | ||||||
|         MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed")); |             final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); | ||||||
|  |             boolean result = HybridUtils.manager.regenerateRoad(world, chunk, 0); | ||||||
|  |             MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed")); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             HybridPlotManager manager = (HybridPlotManager) PS.get().getPlotManager(world); | ||||||
|  |             manager.createRoadEast(plotworld, plot); | ||||||
|  |             manager.createRoadSouth(plotworld, plot); | ||||||
|  |             manager.createRoadSouthEast(plotworld, plot); | ||||||
|  |             MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess"); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |          | ||||||
|  |          | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 boy0001
					boy0001