Posted March 29, 20205 yr Hi there I'm doing block that after click will send message to player. And that message is being sent two times, however if i wouldn't check for being world remote it would be sent four times. Whats happening? Code: Spoiler @Override public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { Main.LOGGER.debug("--- Activation: " + worldIn.getClass() + " " + worldIn.toString() + " " + worldIn.isRemote); if(!worldIn.isRemote()) { Main.LOGGER.debug("Activated"); Plot p = PlotManager.getPlotAtInPosition(worldIn, pos); if (p == null) { if (PlotManager.isPlotAllowed(worldIn, pos) && PlotManager.isPlotTooNear(worldIn, player.getPosition()) == -1 && PlotManager.canHaveAnotherPlot(worldIn, Utilities.getUUID(player)) && PlotManager.canPlaceAndBreak(worldIn, player.getPosition(), Utilities.getUUID(player))) { Plot plot = new Plot(worldIn, pos, plotSize, Utilities.getUUID(player)); Main.sendChatMessage(player, CREATED_PLOT); return true; } return false; } if (player.isSneaking()) { particlesToShow.addAll(p.getBorders()); return true; } else { try { return Minecraft.getInstance().getIntegratedServer().getCommandManager().handleCommand(player.getCommandSource().withPermissionLevel(2), "/plot info") != 0; } catch (Exception e) { try { return worldIn.getServer().getCommandManager().handleCommand(player.getCommandSource().withPermissionLevel(2), "/plot info") != 0; } catch (Exception es) { } } return false; } } return false; } Debug logs: Spoiler [23:47:32] [Client thread/DEBUG] [plotmanager/]: --- Activation: class net.minecraft.client.world.ClientWorld net.minecraft.client.world.ClientWorld@1bb509a6 true [23:47:32] [Client thread/DEBUG] [plotmanager/]: --- Activation: class net.minecraft.client.world.ClientWorld net.minecraft.client.world.ClientWorld@1bb509a6 true [23:47:32] [Server thread/DEBUG] [plotmanager/]: --- Activation: class net.minecraft.world.server.ServerWorld net.minecraft.world.server.ServerWorld@6913fb1 false [23:47:32] [Server thread/DEBUG] [plotmanager/]: Activated [23:47:32] [Server thread/DEBUG] [plotmanager/]: Created new plot at MutableBlockPos{x=-268, y=72, z=-240} with size 18 and with owner: 380df991-f603-344c-a090-369bad2a924a [23:47:32] [Server thread/DEBUG] [plotmanager/]: Added to PlotManager. Now it has 1 plots [23:47:32] [Server thread/DEBUG] [plotmanager/]: --- Activation: class net.minecraft.world.server.ServerWorld net.minecraft.world.server.ServerWorld@6913fb1 false [23:47:32] [Server thread/DEBUG] [plotmanager/]: Activated [23:47:32] [Server thread/DEBUG] [plotmanager/]: Testing from -277 -249 to -259 -231 [23:47:32] [Server thread/DEBUG] [plotmanager/]: Testing from -277 -249 to -259 -231 As you can see "--- Activation" is being sent four times Thanks
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.