feat: add Player Name to PlayerCache
This commit is contained in:
		
							parent
							
								
									e0f71c6a6c
								
							
						
					
					
						commit
						d38d9e3e50
					
				
					 2 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -19,6 +19,7 @@ public class PlayerClientOptionsChangeListener implements Listener {
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onPlayerClientOptionsChange(final PlayerClientOptionsChangeEvent e) {
 | 
					    public void onPlayerClientOptionsChange(final PlayerClientOptionsChangeEvent e) {
 | 
				
			||||||
        final String uuid = e.getPlayer().getUniqueId().toString().replace("-", "");
 | 
					        final String uuid = e.getPlayer().getUniqueId().toString().replace("-", "");
 | 
				
			||||||
 | 
					        this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.NAME, e.getPlayer().getName());
 | 
				
			||||||
        this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.SKINPARTS, e.getSkinParts().getRaw());
 | 
					        this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.SKINPARTS, e.getSkinParts().getRaw());
 | 
				
			||||||
        this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.MAINHAND, e.getMainHand().toString());
 | 
					        this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.MAINHAND, e.getMainHand().toString());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,10 @@ public class PlayerCache {
 | 
				
			||||||
        savePlayerCache();
 | 
					        savePlayerCache();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getName(final String uuid) {
 | 
				
			||||||
 | 
					        return (String) this.playerCache.get("Players." + uuid + "." + PlayerCacheType.NAME.toString());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int getSkinParts(final String uuid) {
 | 
					    public int getSkinParts(final String uuid) {
 | 
				
			||||||
        return (int) this.playerCache.get("Players." + uuid + "." + PlayerCacheType.SKINPARTS.toString());
 | 
					        return (int) this.playerCache.get("Players." + uuid + "." + PlayerCacheType.SKINPARTS.toString());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -72,6 +76,6 @@ public class PlayerCache {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public enum PlayerCacheType {
 | 
					    public enum PlayerCacheType {
 | 
				
			||||||
        SKINPARTS, MAINHAND,
 | 
					        NAME, SKINPARTS, MAINHAND,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue