File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
java/io/github/mattidragon/demobox
resources/data/demobox/lang Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1111import net .minecraft .server .world .ServerWorld ;
1212import net .minecraft .structure .StructurePlacementData ;
1313import net .minecraft .text .Text ;
14+ import net .minecraft .util .Formatting ;
1415import net .minecraft .util .Identifier ;
1516import net .minecraft .util .math .BlockPos ;
1617import net .minecraft .util .math .Vec2f ;
@@ -60,6 +61,7 @@ private static GameOpenProcedure open(GameOpenContext<Settings> context) {
6061 instance .setup ();
6162 activity .listen (GamePlayerEvents .OFFER , instance ::onPlayerOffered );
6263 activity .listen (GamePlayerEvents .LEAVE , instance ::onPlayerLeave );
64+ activity .listen (GamePlayerEvents .JOIN , instance ::onPlayerJoin );
6365 });
6466 }
6567
@@ -85,6 +87,13 @@ private void onPlayerLeave(ServerPlayerEntity player) {
8587 }
8688 }
8789
90+ private void onPlayerJoin (ServerPlayerEntity player ) {
91+ player .sendMessage (Text .translatable ("demobox.info.1" ).formatted (Formatting .GREEN , Formatting .BOLD ));
92+ player .sendMessage (Text .translatable ("demobox.info.2" ).formatted (Formatting .WHITE ));
93+ player .sendMessage (Text .translatable ("demobox.info.3" ).formatted (Formatting .WHITE ));
94+ player .sendMessage (Text .translatable ("demobox.info.4" ).formatted (Formatting .WHITE ));
95+ }
96+
8897 @ NotNull
8998 private PlayerOfferResult onPlayerOffered (PlayerOffer offer ) {
9099 return offer .accept (world , settings .playerPos );
Original file line number Diff line number Diff line change 11{
22 "command.demobox.open.fail" : " Failed to open demo box" ,
33 "demobox.demo.join" : " %s joined the demo" ,
4- "gameType.demobox.demo_box" : " Demo Box"
4+ "gameType.demobox.demo_box" : " Demo Box" ,
5+
6+ "demobox.info.1" : " Welcome to the DemoBox!" ,
7+ "demobox.info.2" : " Here you can experiment with mods in by yourself." ,
8+ "demobox.info.3" : " You might have noticed that you don't have any of your items.\n Don't worry. They'll be returned to you once you leave." ,
9+ "demobox.info.4" : " You can leave using the /demobox leave command.\n You can also use the /game command to leave and join active demos."
510}
You can’t perform that action at this time.
0 commit comments