-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from preprocessor/main
Fixed the welcome message
- Loading branch information
Showing
4 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package lusiiplugin.mixin; | ||
|
||
import net.minecraft.core.net.packet.Packet1Login; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.server.net.handler.NetLoginHandler; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.io.File; | ||
|
||
@Mixin(value = NetLoginHandler.class, remap = false) | ||
public abstract class NetLoginHandlerMixin { | ||
@Shadow | ||
private MinecraftServer mcServer; | ||
|
||
@Inject(method = "doLogin", at = @At("TAIL")) | ||
private void welcomeMessage(Packet1Login packet1login, CallbackInfo ci) { | ||
File playerData = new File("world/players/" + packet1login.username + ".dat"); | ||
|
||
if (!playerData.exists()) { | ||
this.mcServer.serverCommandHandler.sendMessageToAllPlayers("§4Welcome §3" + packet1login.username + "§4 to the server!" ); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters