Closed p1ut0nium-git closed 2 years ago
I've tested out the scripts you have posted and can not reproduce this issue. I combined all three snips you posted into the following script and all three stages were applied.
import crafttweaker.api.event.entity.player.MCPlayerLoggedInEvent;
import crafttweaker.api.events.CTEventManager;
import mods.gamestages.StageHelper;
StageHelper.grantStageOnJoinWithCondition(player => !player.hasGameStage("hostile"), "peaceful");
StageHelper.grantStageOnJoinWithCondition(player => !player.isCreative(), "join_example_two");
CTEventManager.register<MCPlayerLoggedInEvent>((event) => {
var player = event.player;
player.addGameStage("peaceful2");
player.sendMessage("hi");
});
.zs
extension in the /scripts
folder/gamestage info
to see your stages.I asked a few others to try running the script with the same versions you listed and they also had no issue. This suggests that the issue is specific to you or your game environment.
Not pirated. Definitely saved scripts. So it is probably some kind of mod conflict. I'll look further into it.
It does work in a new world with just these mods:
Environment Details
Mod Version: 7.3.10 Game Version: 1.16.5 Loader Type: Forge Loader Version: 36.2.9 Game Type: Client
The Issue
I am using CraftTweaker version: 7.1.2.468
This doesn't seem to work (tested in single player map; haven't tested on server yet). The player joins, and they don't have the "hostile" game stage, yet they don't receive the "peaceful" game stage:
StageHelper.grantStageOnJoinWithCondition(player => !player.hasGameStage("hostile"), "peaceful");
The example from the CraftTweaker docs doesn't work either:
StageHelper.grantStageOnJoinWithCondition(player => !player.isCreative(), "join_example_two");
I am using the import statement:
import mods.gamestages.StageHelper;
This doesn't work either:Log Files
No errors in log file