-
Posts
17 -
Joined
-
Last visited
Everything posted by SonMooSans
-
I need a multiple line text editor for my mod but TextField only supports one line input After I did some research, I found a example but it doesn't support 1.17 I had check SignEditScreen, I think it's petty hard for myself to remake it and I don't want to spend too much time on a gui It will be much better if there's already a class or library , so is there a class or lib that can do this?
-
Okay thx, It seems worked! And that error also been fixed
-
ModTestChannel.registerMessage(RunCommandRequest_ID, RunCommandRequest.class, RunCommandRequest::encode, RunCommandRequest::decode, MessageHandlerServer::GetRunCommandRequest, Optional.of(PLAY_TO_SERVER)); i sure i have register it, anyway I will try the one that takes an int as its argument.
-
hmm a new problem when I try to debug it It throws error when buf.readString() package xxx; import net.minecraft.network.PacketBuffer; public class RunCommandRequest { public RunCommandRequest(String i_Command) { Command = i_Command; } public String GetCommand() { return Command; } private RunCommandRequest() { } public static RunCommandRequest decode(PacketBuffer buf) { RunCommandRequest retval = new RunCommandRequest(); retval.Command = buf.readString(); //error return retval; } public void encode(PacketBuffer buf) { buf.writeString(Command); } private String Command; }
-
I want to execute Player from the server to run the /give command by sending a packet , I try to let player send a packet to the server then the server runs XXX.handleCommand(AdminLevelSource(Player), RunCommandPacket.getCommand()); But it will close the player's connection and throw an error What is the solution?
-
[1.16] PlayerLoggedInEvent won't be fired if player is banned
SonMooSans replied to SonMooSans's topic in Modder Support
okay, anyway thx -
[1.16] PlayerLoggedInEvent won't be fired if player is banned
SonMooSans replied to SonMooSans's topic in Modder Support
Maybe there's an event that fires when banned player failed to connect the server? -
[1.16] PlayerLoggedInEvent won't be fired if player is banned
SonMooSans replied to SonMooSans's topic in Modder Support
Yes -
[1.16] PlayerLoggedInEvent won't be fired if player is banned
SonMooSans replied to SonMooSans's topic in Modder Support
I need an event that fires when a banned player try to rejoin -
[1.16] PlayerLoggedInEvent won't be fired if player is banned
SonMooSans replied to SonMooSans's topic in Modder Support
Ok thx, but It doesn't fire if banned player try to join back [14:49:27] [Server thread/INFO] [minecraft/ServerLoginNetHandler]: Disconnecting com.mojang.authlib.GameProfile@5d54406a[id=9a69ed4d-3c07-339c-9954-13b204826372,name=Dev,properties={},legacy=false] (/Server IP) : You are banned from this server. -
Bec I want to add a command to list all the players' position so ops don't have to check them one by one something like: "Bob X:1 Y:20 Z:20" "Stave X:2 Y:1 Z:10"
-
I want to make a mod that will track the player's position per 5s, then ops can get a list of players and TP to their position by using a command. but after I finished it and start debugging. Here's a big problem of delay, I tested it on a small server that only have myself it takes at least 2s to run. What if it runs on a large server?
-
I think I found the problem, it works after I removed this: .requires((commandSource) -> commandSource.hasPermissionLevel(4)) How can I let the command blocks run it when Require Permission Level is 4?
-
package minecrafttest.commands; import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.command.FunctionObject; import net.minecraft.command.arguments.MessageArgument; import net.minecraft.entity.Entity; import net.minecraft.util.Util; import net.minecraft.util.text.ChatType; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; import java.util.Collection; import java.util.Random; import java.util.RandomAccess; import static net.minecraft.util.math.MathHelper.clamp; public class sayCommand { public static void register(CommandDispatcher<CommandSource> dispatcher) { LiteralArgumentBuilder<CommandSource> mbequoteCommand = Commands.literal("assend") .requires((commandSource) -> commandSource.hasPermissionLevel(4)) .then(Commands.argument("Name", StringArgumentType.string()) .then(Commands.argument("Input", MessageArgument.message()) .executes(sayCommand::SendAs) ) ); dispatcher.register(mbequoteCommand); } static int SendAs(CommandContext<CommandSource> commandContext) throws CommandSyntaxException { String Name = StringArgumentType.getString(commandContext, "Name"); String input = MessageArgument.getMessage(commandContext, "Input").getUnformattedComponentText(); TranslationTextComponent finalText = new TranslationTextComponent("chat.type.announcement", Name, input); commandContext.getSource().getServer().getPlayerList().func_232641_a_(finalText, ChatType.SYSTEM, Util.DUMMY_UUID); return 1; } }
-
I made a mod that follows players to send message as custom display name using command: /assend It is working when I execute the command, but when I execute this command by command block, nothing happened the command block output is Java code of that command: static int SendAs(CommandContext<CommandSource> commandContext) throws CommandSyntaxException { String Name = StringArgumentType.getString(commandContext, "Name"); String Input = MessageArgument.getMessage(commandContext, "Input").getUnformattedComponentText(); TranslationTextComponent finalText = new TranslationTextComponent("chat.type.announcement", Name, input); commandContext.getSource().getServer().getPlayerList().func_232641_a_(finalText, ChatType.SYSTEM, Util.DUMMY_UUID); return 1; } How can i fix it?