MapRenderer and (possibly) user caching issues

Discussion in 'Plugin Development' started by Fuizziy, Jul 8, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    Fuizziy

    Dear community,

    I am asking for quite a technical bit of help here. I am working with MapRenderers, and doing a basic 1.8 plugin for my 1.8-1.15 server, that shows to a player the location where he can run away from the danger.

    Here is the renderer class: https://pastebin.com/6ihGG7sL
    And here is the way I give the map to the player :
    Code:
        public ItemStack getMap(Player player) {
            MapView view = Bukkit.createMap(player.getWorld());
    
            for(MapRenderer r : view.getRenderers()) {
                view.removeRenderer(r);
            }
            view.addRenderer(new AreaRenderer(endPoint));
    
            ItemStack map = new ItemStack(Material.MAP);
            map.setDurability(view.getId());
    
            ItemMeta im = map.getItemMeta();
            im.setDisplayName(ChatColor.GREEN + "Carte de survie");
            im.setLore(Arrays.asList(ChatColor.GRAY + "T'indique l'emplacement de la",
                    ChatColor.GRAY + "safezone, là où la corruption",
                    ChatColor.GRAY + "ne t'atteindra pas"));
            map.setItemMeta(im);
            return map;
        }
    As you can see, the code itself works well :

    Image (open)
    upload_2020-7-9_5-34-46.png


    The only issue, though, is that when the server restarts and reinitialize the world (hence the players data remotely) with a rough rm -rf <map-folder> && cp -r <clean-map> <map-folder>, players getting a fresh new generated map with the same damagedAmount that they had before have it frozen. The cursor isn't moving, like the renderer isn't rendering anymore. There is no server-side error, nor client-side error.

    Reinstalling the Minecraft version locally or switching versions solve the issue (but I won't ask my players to do it at the beginning of each game haha..), and getting a map with another damaged value than the previous one solve it too (but the only mean to give a defined "N" damaged value to the map is to create "N" MapView before, which is not a solution).

    ----------------

    Two possible reasons for that came through my mind:
    - Minecraft is somehow caching locally player's serverside data, which is useful for resource packs and, probably... custom maps, since they can include very large 128*128p buffered image *optimization intensifies*. And the fact that the world's cache is cleared before the start of every game would cause synchronization issues. -> The problem doesn't appear in LOCAL 1.14, but does appear in LOCAL 1.8 for instance, which leads me to think that the issue is indeed located in the local player files of legacy versions. Any way to clear user's current server cache locally?
    - Cracks UUID (Somehow ?). Since my beta server is offline mode. -> No changes to the issue after switching to online-mode

    Does anyone has a strong understanding of that particular topic? Any help would be highly appreciated!

    Thank you very much for your time, wishing you all a great day :)
     
    Last edited: Jul 8, 2020
  2. Offline

    timtower Administrator Administrator Moderator

    Locked
    Protocol hacks are not supported by Bukkit
     
Thread Status:
Not open for further replies.

Share This Page