Reload a chunk #3


  • New
  • Enhancment
Open
Assigned to _ForgeUser6834162
  • _ForgeUser1229275 created this issue Feb 2, 2012

    What is the enhancement in mind? How should it look and feel?
    A command to simply reload the chunk the player is standing on.  It is common for some clients just based on the blocks where they are tp'ing to or /home, /spawn, etc etc to have a world hole. This would be an ultra helpful command if it could be implemented in a more stand alone plugin like this.

    Please provide any additional information below.
    I believe the following code would be at least a portion of what would be needed.  I got this from someone who didn't feel like making a plugin but was willing to offer this much help lol.

    public FixChunk(Command plugin) {
            this.plugin = plugin;
        }

        @Override
        public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("fixchunk")) {
                if (!plugin.isAuthorized(cs, "commands.fixchunk")) {
                    Utils.dispNoPerms(cs);
                    return true;
                }
                if (!(cs instanceof Player)) {
                    cs.sendMessage(ChatColor.RED + "This command is only available to players!");
                    return true;
                }
                Player p = (Player) cs;
                Chunk c = p.getLocation().getChunk();
                boolean worked = p.getWorld().refreshChunk(c.getX(), c.getZ());
                if (worked) {
                    cs.sendMessage(ChatColor.BLUE + "The chunk you're standing in has been reloaded!");
                }
                if (!worked) {
                    cs.sendMessage(ChatColor.RED + "The chunk could not be reloaded.");
                }
                return true;
            }
            return false;
        }

  • _ForgeUser1229275 added the tags New Enhancment Feb 2, 2012

To post a comment, please login or register a new account.