aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.md8
-rw-r--r--UNLICENSE21
-rw-r--r--src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java5
-rw-r--r--src/main/resources/fabric.mod.json19
-rw-r--r--src/main/resources/icon.pngbin0 -> 6767 bytes
5 files changed, 49 insertions, 4 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e240e9e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# Simple Rename Command
+
+A dead simple command to rename items to any text component.
+
+## Support
+
+If you find a bug, file it on the issue tracker or join the
+[Discord](https://discord.gg/A2FEXREAtQ).
diff --git a/UNLICENSE b/UNLICENSE
new file mode 100644
index 0000000..276e406
--- /dev/null
+++ b/UNLICENSE
@@ -0,0 +1,21 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute
+this software, either in source code form or as a compiled binary, for any
+purpose, commercial or non-commercial, and by any means.
+
+In jurisdictions that recognize copyright laws, the author or authors of
+this software dedicate any and all copyright interest in the software to
+the public domain. We make this dedication for the benefit of the public
+at large and to the detriment of our heirs and successors. We intend this
+dedication to be an overt act of relinquishment in perpetuity of all present
+and future rights to this software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <https://unlicense.org/>
diff --git a/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java b/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java
index 780b9f2..3cf709f 100644
--- a/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java
+++ b/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java
@@ -16,6 +16,7 @@ import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.network.chat.ChatType.Bound;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
+import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
@@ -29,10 +30,10 @@ public class SimpleRenameCommand implements ModInitializer {
.executes(ctx -> {
ServerPlayer src = ctx.getSource().getPlayerOrException();
ItemStack stack = src.getMainHandItem();
- if (stack != null) {
+ if (!stack.isEmpty()) {
stack.set(DataComponents.CUSTOM_NAME, ctx.getArgument("itemName", Component.class));
} else {
- src.sendChatMessage(OutgoingChatMessage.create(PlayerChatMessage.system("slur")), true, ChatType.bind(ChatType.CHAT, ctx.getSource()));
+ src.sendSystemMessage(Component.literal("You must be holding an item.").withStyle(ChatFormatting.RED));
}
return Command.SINGLE_SUCCESS;
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index f661659..72832b7 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -3,9 +3,24 @@
"id": "simple-rename-command",
"version": "${version}",
"name": "Simple Rename Command",
- "description": "Do you really need me to tell you what it does?",
- "authors": ["Rosa (girlonthe.net)"],
+ "description": "A dead simple command to rename the held item.",
+ "authors": [
+ {
+ "name": "Rosa (girlonthe.net)",
+ "contact": {
+ "discord": "https://discord.gg/A2FEXREAtQ",
+ "email": "rosaontheweb@proton.me",
+ "matrix": "https://matrix.to/#/@rosa:girlonthe.net"
+ }
+ }
+ ],
+ "contact": {
+ "discord": "https://discord.gg/A2FEXREAtQ",
+ "issues": "https://codeberg.org/girlonthenet/simple-rename-command/issues",
+ "sources": "https://codeberg.org/girlonthenet/simple-rename-command"
+ },
"license": "Unlicense",
+ "icon": "icon.png",
"environment": "*",
"entrypoints": {
"main": ["net.girlonthe.simplerenamecommand.SimpleRenameCommand"]
diff --git a/src/main/resources/icon.png b/src/main/resources/icon.png
new file mode 100644
index 0000000..0931072
--- /dev/null
+++ b/src/main/resources/icon.png
Binary files differ