VirtualChest - Provide virtual chest GUIs for menus like ChestCommands (SpongeForge/SpongeVanilla 1.10.2, 1.11.2, and 1.12.2)

mcbbs… I live in China. I went there.:sweat_smile:

Oh, okey… Thank you.

Using HideFlags for UnsafeData doesn’t work. Is there any way you could fix that? Really want to be able to hide the flags for swords/picks/armor/etc

yes i was wondering how the delay: 60; worked if it wen off of ticks or seconds

@yamy19 Well it works in the asynchonous way like this:

Sponge.getScheduler()
    .createTaskBuilder()
    .delayTicks(60)
    .execute(() -> anotherCommand())
    .submit(thePlugin);

You can find the implementation in the GitHub repo.

Maybe you used the wrong flag. For convenience, you can try to use the HideAttributes directly like this:

    Item {
        Count = 1
        ItemType = "minecraft:xxxx_sword"
        UnsafeDamage = 0
        DisplayName = "A sword"
        ItemLore = [
            "Lore 1"
            "Lore 2"
            "Lore 3"
        ]
        HideAttributes = true
    }

Could you pls fix this?

[Server thread/ERROR] [Sponge]: Could not pass FMLServerStartedEvent to Plugin{id=virtualchest,name=VirtualChest, version=0.3.6, description=A sponge plugin providing virtual chest GUIs for menus., authors=[ustc_zzzz], source=C:\Users\Nipo Noland\Desktop\Server\Server_New\mods\[GUI菜单]VirtualChest-0.3.6.jar}
org.spongepowered.api.network.ChannelRegistrationException: Error registering channel "BungeeCord" to Plugin{id=virtualchest, name=VirtualChest, version=0.3.6, description=A sponge plugin providing virtual chest GUIs for menus., authors=[ustc_zzzz], source=C:\Users\Nipo Noland\Desktop\Server\Server_New\mods\[GUI菜单]VirtualChest-0.3.6.jar}
        at org.spongepowered.mod.network.SpongeModNetworkManager.createRawChannel(SpongeModNetworkManager.java:137) ~[SpongeModNetworkManager.class:1.11.2-2282-6.1.0-BETA-2358]
        at com.github.ustc_zzzz.virtualchest.action.VirtualChestActions.init(VirtualChestActions.java:67) ~[VirtualChestActions.class:?]
        at com.github.ustc_zzzz.virtualchest.VirtualChestPlugin.onStartingServer(VirtualChestPlugin.java:232) ~[VirtualChestPlugin.class:?]
        at org.spongepowered.common.event.listener.GameStartedServerEventListener_VirtualChestPlugin_onStartingServer6.handle(Unknown Source) ~[?:?]
        at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:1.11.2-2282-6.1.0-BETA-2358]
        at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:314) [SpongeModEventManager.class:1.11.2-2282-6.1.0-BETA-2358]
        at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:345) [SpongeModEventManager.class:1.11.2-2282-6.1.0-BETA-2358]
        at org.spongepowered.mod.SpongeMod.onStateEvent(SpongeMod.java:212) [SpongeMod.class:1.11.2-2282-6.1.0-BETA-2358]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.11.2.jar:?]
        at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:246) [LoadController.class:?]
        at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:224) [LoadController.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.11.2.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.11.2.jar:?]
        at net.minecraftforge.fml.common.LoadController.redirect$onPost$zzd000(LoadController.java:553) [LoadController.class:?]
        at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147) [LoadController.class:?]
        at net.minecraftforge.fml.common.Loader.serverStarted(Loader.java:891) [Loader.class:?]
        at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarted(FMLCommonHandler.java:297) [FMLCommonHandler.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:444) [MinecraftServer.class:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
Caused by: java.lang.RuntimeException: That channel is already registered
        at net.minecraftforge.fml.common.network.NetworkRegistry.newChannel(NetworkRegistry.java:155) ~[NetworkRegistry.class:?]
        at org.spongepowered.mod.network.SpongeModChannelBinding.<init>(SpongeModChannelBinding.java:52) ~[SpongeModChannelBinding.class:1.11.2-2282-6.1.0-BETA-2358]
        at org.spongepowered.mod.network.SpongeRawChannel.<init>(SpongeRawChannel.java:55) ~[SpongeRawChannel.class:1.11.2-2282-6.1.0-BETA-2358]
        at org.spongepowered.mod.network.SpongeModNetworkManager.createRawChannel(SpongeModNetworkManager.java:135) ~[SpongeModNetworkManager.class:1.11.2-2282-6.1.0-BETA-2358]
        ... 33 more

yes I was just wondering if there was a way to do a tier system say i have 2 items in the same position and i want one rank to see one item and another rank to see the other item how would i do this?

There is, remember doing it in the past. Seems the examples have changed since I’ve last used Virtual Chest and don’t have a minecraft server to test stuff on.

And here you can see how in example two, they have 2 items in the same position, based off permissions:

Position-9-2 = [{
    Item {
        Count = 1
        ItemType = "minecraft:emerald_block"
        UnsafeDamage = 0
        DisplayName = "&lGoodbye! %player_name%"
        ItemLore = [
            "&eYou will open another chest GUI"
            "&eIt will take you 7 if you click this item"
        ]
    }
    KeepOpen = true
    PrimaryAction = "cost: 7; virtualchest open example"
    SecondaryAction = "cost: 7; virtualchest open example"
    RequiredBalances = [
        "7"
    ]
    IgnoredPermissions = [
        "virtualchest.open.self.example"
    ]
}, {
    Item {
        Count = 1
        ItemType = "minecraft:barrier"
        UnsafeDamage = 0
        DisplayName = "&lOops! %player_name%"
        ItemLore = [
            "&eYou want to open another chest GUI"
            "&eBut you do not have enough money (7)"
        ]
    }
    KeepOpen = true
}]

Such an awesome plugin; thank you for your work!!

I have just one feature suggestion (unless this or something like it is already implemented and I can’t seem to figure out how to do it)…

Would there be a way to pass another player as a variable argument, such as when opening the VC in a chat command. I know at this moment, this opens the VC on that player’s screen…
/vcgui player

But maybe with a subcommand such as this…
/vcgui pass player

This way we could pass another player to a command such as ‘give’ or ‘invsee’.

Thanks again!!

Pass a player? Could you explain it further

So I use my VC gui for easy command access. If I want to skip a night, I set the cmd /time set 0 to a bed or something in the VC gui.

That said, some commands have variable arguments such as a player’s name; invsee, feed, and heal being some.

If set a VC gui item to /heal, it will heal me. If I set the item to /heal tridaak, it would heal you.

Basically, I was wondering if there was or could be a way to have a command (such as /heal %var%) where %var% is a placeholder in the command and is set in the chat command.

/vcgui pass sexydexy would open my VC gui and set the variable. When I click an item that has a variable command, it would pass ‘sexydexy’ to its placeholder. It wouldn’t have to be ‘pass’ either, ‘arg’ or ‘var’ could work as well, I think.

This could work for things other than names as well such as /time set %var%.

I hope this helps to clarify, mainly because after reading it back, I might have confused myself now. :confused:

It makes sense, but find difficulties finding where it would be implemented.
Could see it as a way to make some “admin panels”, such as rewards, don’t need to remember each command, can have the gui open up and choose an option. However, having /time set %% + /heal %% and other such commands seems like it needs to add too many variables and having a GUI to manage that wont help much.

It doesn’t excessively hard to add it, hope @zzzz considers this and keeps working on the plugin. VC is one of my favorite plugins on here.

Hello, I started using this plugin a little while ago, I do not know if it is still in development, but I wonder if it has a prevision, or some form of it working with ApiPlaceHolder 4.0+ versions, I can only use it until Version 3.12, and it would be Cool for working with Balance and Rank variables added in the latest versions. Congratulations on the wonderful work.

Yes, I’m working on it, in order to support the PlacehoderAPI 4.x.

Well, VC v0.3.9 now supports both Placeholder API 3.x and 4.x.

Hello,
I saw on GitHub, that you started on development for Sponge API 7.0.0.
I would like to use your plugin on my server, which is on Sponge API 7.0.0.
Is it possible to release first alpha/beta (or whatever) version for this API in a next few days?

Thank you very much,
Krosta8

@Krosta8 Sorry, I can’t.

There is a bug in Sponge server where custom inventories cannot handle inventory events. Please refer to this Pull Request. The plugin cannot work normally until this Pull Request is merged in to Sponge.

If you really want to use it on api v7.0.0, you can firstly clone the repo of SpongeForge/SpongeVanilla and apply this Pull Request, then build it by yourself. Then you can secondly clone the repo of VirtualChest and also build the plugin by yourself.

2 Likes

Is this pluggin safe for public server use without any exploits?

@zzzz is it possible to have an item to item shop? for example so a player can buy 1 item with another item and if so can i get an example on how i would go about it?