当前位置: 首页>>代码示例>>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;未经允许,请勿转载。