當前位置: 首頁>>代碼示例>>Java>>正文


Java LContainer類代碼示例

本文整理匯總了Java中net.nickac.lithium.backend.controls.LContainer的典型用法代碼示例。如果您正苦於以下問題:Java LContainer類的具體用法?Java LContainer怎麽用?Java LContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LContainer類屬於net.nickac.lithium.backend.controls包,在下文中一共展示了LContainer類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void execute(List<String> data) {
    UUID containerUUID = UUID.fromString(data.get(0));
    UUID controlUUID = UUID.fromString(data.get(1));


    LControl container = LithiumMod.getWindowManager().getControlById(containerUUID);
    if (container != null) {
        if (container instanceof LContainer && LithiumMod.getCurrentLithium() != null) {
            LControl toRemove = LithiumMod.getWindowManager().getControlById(controlUUID);
            if (toRemove != null) {
                LithiumMod.getCurrentLithium().removeControl(toRemove);
            }
        }
    }
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:18,代碼來源:RemoveFromContainer.java

示例2: replaceControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
public static void replaceControl(LContainer cc, UUID u, LControl c) {
	for (LControl control : cc.getControls()) {
		if (control instanceof LContainer) {
			replaceControl(((LContainer) control), u, c);
		} else if (control.getUUID().equals(u)) {
			if (currentLithium != null) {
				//Try to check if it is a window
				currentLithium.removeControl(control);
				currentLithium.addControlToGUI(c);
			} else if (currentLithiumOverlay != null) {
				//It might be the overlay
				currentLithiumOverlay.addControl(c);
			}
		}
	}
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:18,代碼來源:LithiumMod.java

示例3: execute

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void execute(List<String> data) {
    try {
        //Deserialize the control
        LControl newC = SerializationUtils.stringToObject(data.get(1), LControl.class);

        UUID uuid = UUID.fromString(data.get(0));
        LControl l = LithiumMod.getWindowManager().getControlById(uuid);
        if (l != null) {
            //Check if it is a container
            if (l instanceof LContainer) {
                ((LContainer) l).addControl(newC);
                if (LithiumMod.getCurrentLithium() != null) {
                    //Lets try adding this control.
                    //It might work...
                    LithiumMod.getCurrentLithium().addControlToGUI(newC);
                }
            }
        } else {
            //It might be a window....
            LWindow window = LithiumMod.getWindowManager().getWindowById(uuid);
            if (window != null) {
                window.addControl(newC);
                if (LithiumMod.getCurrentLithium() != null &&
                        LithiumMod.getCurrentLithium().getBaseWindow().getUUID().equals(uuid)) {
                    LithiumMod.getCurrentLithium().addControlToGUI(newC);
                }
            }

        }

    } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException ex) {
        LithiumMod.log("Received malformed packet from server. Ignoring!");
    }
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:37,代碼來源:AddToContainer.java

示例4: removeControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
public void removeControl(LControl c) {
	controls.remove(c.getUUID());
	if (c instanceof LContainer) {
		((LContainer) c).getControls().forEach(this::removeControl);
	}
	nativeControls.remove(c.getUUID());
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:8,代碼來源:LithiumWindowManager.java

示例5: registerControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
public void registerControl(LControl c) {
	controls.put(c.getUUID(), c);
	if (c instanceof LContainer) {
		((LContainer) c).getControls().forEach(this::registerControl);
	}
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:7,代碼來源:LithiumWindowManager.java

示例6: onEnable

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
@Override
public void onEnable() {
    instance = this;
    this.containerMap = new ContainerMap();


    containerMap.registerContainer(LWindow.class, ReceiveWindow.class);
    containerMap.registerContainer(LOverlay.class, ShowOverlay.class);


    this.containerManager = new ContainerManager(containerMap);
    playerManager = new LithiumPlayerManager(containerManager);

    LithiumConstants.onRefresh = (viewer, c) -> {
        Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
            if (viewer != null) {
                LithiumPlayer lithiumPlayer = playerManager.getPlayer(Bukkit.getPlayer(viewer));
                if (lithiumPlayer != null) {
                    lithiumPlayer.refreshControl(c.getUUID());
                }
            }
        });

    };
    LithiumConstants.onControlRuntime = new LithiumRuntimeControlHandler() {
        @Override
        public void addControl(LControl c, LContainer ct, UUID viewer) {
            Player p = Bukkit.getPlayer(viewer);
            if (p != null && ct instanceof LControl) {
                playerManager.getPlayer(p).writePacket(new AddToContainer(ct, c));
            }
        }

        @Override
        public void removeControl(LControl c, LContainer ct, UUID viewer) {
            Player p = Bukkit.getPlayer(viewer);
            if (p != null && ct instanceof LControl) {
                playerManager.getPlayer(p).writePacket(new RemoveFromContainer(ct, c));
            }
        }
    };
    LithiumConstants.onClose = (c, viewer) -> playerManager.getPlayer(Bukkit.getPlayer(viewer)).closeInterface();
    //We need to register the incoming message plugin message!
    Bukkit.getMessenger().registerIncomingPluginChannel(this, LITHIUM_CHANNEL, new LithiumListener(playerManager));
    Bukkit.getMessenger().registerOutgoingPluginChannel(this, LITHIUM_CHANNEL);
    Bukkit.getPluginManager().registerEvents(new PlayerEvents(playerManager), this);
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Spigot,代碼行數:48,代碼來源:LithiumPlugin.java

示例7: AddToContainer

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
public AddToContainer(LContainer lContainer, LControl lControl) {
    this.lContainer = lContainer;
    this.lControl = lControl;
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Spigot,代碼行數:5,代碼來源:AddToContainer.java

示例8: RemoveFromContainer

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
public RemoveFromContainer(LContainer lContainer, LControl lControl) {
    this.lContainer = lContainer;
    this.lControl = lControl;
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Spigot,代碼行數:5,代碼來源:RemoveFromContainer.java

示例9: registerControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
private void registerControl(LControl c) {
    if (c == null) return;
    if (c instanceof LContainer)
        ((LContainer) c).getControls().forEach(this::registerControl);
    controls.put(c.getUUID(), c);
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Spigot,代碼行數:7,代碼來源:ContainerManager.java

示例10: removeControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
public void removeControl(UUID l) {
    if (!controls.containsKey(l)) return;
    LControl ctrl = controls.get(l);
    if (ctrl instanceof LContainer) ((LContainer) ctrl).getControls().forEach(this::removeControl);
    controls.remove(l);
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Spigot,代碼行數:7,代碼來源:ContainerManager.java

示例11: addControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
void addControl(LControl c, LContainer ct, UUID viewer); 
開發者ID:NickAcPT,項目名稱:Lithium-Backend,代碼行數:2,代碼來源:LithiumRuntimeControlHandler.java

示例12: removeControl

import net.nickac.lithium.backend.controls.LContainer; //導入依賴的package包/類
void removeControl(LControl c, LContainer ct, UUID viewer); 
開發者ID:NickAcPT,項目名稱:Lithium-Backend,代碼行數:2,代碼來源:LithiumRuntimeControlHandler.java


注:本文中的net.nickac.lithium.backend.controls.LContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。