本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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!");
}
}
示例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());
}
示例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);
}
}
示例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);
}
示例7: AddToContainer
import net.nickac.lithium.backend.controls.LContainer; //导入依赖的package包/类
public AddToContainer(LContainer lContainer, LControl lControl) {
this.lContainer = lContainer;
this.lControl = lControl;
}
示例8: RemoveFromContainer
import net.nickac.lithium.backend.controls.LContainer; //导入依赖的package包/类
public RemoveFromContainer(LContainer lContainer, LControl lControl) {
this.lContainer = lContainer;
this.lControl = lControl;
}
示例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);
}
示例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);
}
示例11: addControl
import net.nickac.lithium.backend.controls.LContainer; //导入依赖的package包/类
void addControl(LControl c, LContainer ct, UUID viewer);
示例12: removeControl
import net.nickac.lithium.backend.controls.LContainer; //导入依赖的package包/类
void removeControl(LControl c, LContainer ct, UUID viewer);