forked from unimatrix/web
Coordinate common and material pack ownership through Velocity
This commit is contained in:
parent
085e99d905
commit
62638f4957
1 changed files with 238 additions and 9 deletions
|
|
@ -46,6 +46,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
private ExistingGuildService guild;
|
||||
private final GuildBookings bookings=new GuildBookings();
|
||||
private final Set<UUID> boarding=new HashSet<>();
|
||||
private ProxyPackBridge proxyPacks;
|
||||
private final Set<UUID> guiPackLoaded=new HashSet<>();
|
||||
private final Map<UUID,NetworkArtworkPolicy.Pack> offeredGuiPacks=new HashMap<>();
|
||||
private NetworkArtworkPolicy.Pack guiPack(Player player){
|
||||
|
|
@ -74,7 +75,8 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
registrar=new NamespacedKey(this,"house_registrar");
|
||||
modernMenus=new MCGUIMenus(this);
|
||||
ecologyArtwork=new EcologyArtwork(this);
|
||||
new PlanetTexturePacks(this);
|
||||
proxyPacks=new ProxyPackBridge(this,this::receiveProxyArtworkStatus);
|
||||
new PlanetTexturePacks(this,proxyPacks);
|
||||
|
||||
sidebar=new PersonalSidebar(this);nameplates=new PublicNameplates(this);
|
||||
for(String command:List.of("start","spice","sellall","exchange","house","mentat","drgui","drscoreboard","guildtravel","clan","company","polgui"))Objects.requireNonNull(getCommand(command)).setExecutor(this);
|
||||
|
|
@ -265,6 +267,11 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
private void offerGuiPack(Player p){offerGuiPack(p,true);}
|
||||
private void offerGuiPack(Player p,boolean force){
|
||||
if(!p.isOnline()||BedrockForms.isBedrock(p))return;
|
||||
if(proxyPacks.ownsCommon()){
|
||||
proxyPacks.requestStatus(p);
|
||||
if(lobby(p)){MCGUIMenus.offerPack(p);ecologyArtwork.offer(p);}
|
||||
return;
|
||||
}
|
||||
var pack=guiPack(p);
|
||||
if(!force&&pack.equals(offeredGuiPacks.get(p.getUniqueId())))return;
|
||||
guiPackLoaded.remove(p.getUniqueId());
|
||||
|
|
@ -281,8 +288,12 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
giveCodex(p,false);
|
||||
if(sidebar.enabled(p))refreshSidebar(p);
|
||||
},40L);}
|
||||
private void receiveProxyArtworkStatus(Player player,boolean loaded){
|
||||
if(loaded)guiPackLoaded.add(player.getUniqueId());
|
||||
else guiPackLoaded.remove(player.getUniqueId());
|
||||
}
|
||||
@EventHandler public void packStatus(PlayerResourcePackStatusEvent e){
|
||||
if(!NetworkArtworkPolicy.PACK_ID.equals(e.getID()))return;
|
||||
if(proxyPacks.ownsCommon()||!NetworkArtworkPolicy.PACK_ID.equals(e.getID()))return;
|
||||
getLogger().info("GUI pack status for "+e.getPlayer().getName()+": "+e.getStatus());
|
||||
if(e.getStatus()==PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED){guiPackLoaded.add(e.getPlayer().getUniqueId());e.getPlayer().sendMessage(Component.text("DuneRealms artwork loaded. Reopen your menu.",NamedTextColor.GREEN));return;}
|
||||
guiPackLoaded.remove(e.getPlayer().getUniqueId());
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff