9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00

Fix Fakeplayer remove command

This commit is contained in:
violetc
2022-08-01 19:59:50 +08:00
parent 956609a17c
commit 07e99d3a60
2 changed files with 13 additions and 12 deletions

View File

@@ -189,12 +189,13 @@ index a85a5de7d85cf6c5e19c0245c40e6106e6623007..898c61c25675232e203ee2c872ca2580
public final String worldName;
diff --git a/src/main/java/top/leavesmc/leaves/bot/BotCommand.java b/src/main/java/top/leavesmc/leaves/bot/BotCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..292fede3bb850892e57640814440bdcebfd43aec
index 0000000000000000000000000000000000000000..50407b7a4f66d4bd683fb8a687baf04b5bd01f04
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/bot/BotCommand.java
@@ -0,0 +1,101 @@
@@ -0,0 +1,102 @@
+package top.leavesmc.leaves.bot;
+
+import net.minecraft.world.damagesource.DamageSource;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
@@ -291,7 +292,7 @@ index 0000000000000000000000000000000000000000..292fede3bb850892e57640814440bdce
+ return;
+ }
+
+ bot.kill();
+ bot.die(DamageSource.OUT_OF_WORLD);
+ }
+}
diff --git a/src/main/java/top/leavesmc/leaves/bot/MojangAPI.java b/src/main/java/top/leavesmc/leaves/bot/MojangAPI.java

View File

@@ -30,10 +30,10 @@ index 898c61c25675232e203ee2c872ca25804c41358c..4d6d025c78086f186da710ae46f65eda
}
diff --git a/src/main/java/top/leavesmc/leaves/bot/BotCommand.java b/src/main/java/top/leavesmc/leaves/bot/BotCommand.java
index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f37234268 100644
index 50407b7a4f66d4bd683fb8a687baf04b5bd01f04..cda4e43579f5d771acc30e16f7e40ac6221c72ec 100644
--- a/src/main/java/top/leavesmc/leaves/bot/BotCommand.java
+++ b/src/main/java/top/leavesmc/leaves/bot/BotCommand.java
@@ -5,7 +5,11 @@ import org.bukkit.ChatColor;
@@ -6,7 +6,11 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -45,7 +45,7 @@ index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f
import java.util.ArrayList;
import java.util.List;
@@ -15,7 +19,7 @@ public class BotCommand extends Command {
@@ -16,7 +20,7 @@ public class BotCommand extends Command {
public BotCommand(String name) {
super(name);
this.description = "FakePlayer Command";
@@ -54,7 +54,7 @@ index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f
this.setPermission("bukkit.command.bot");
}
@@ -26,13 +30,29 @@ public class BotCommand extends Command {
@@ -27,13 +31,29 @@ public class BotCommand extends Command {
if (args.length <= 1) {
list.add("create");
list.add("remove");
@@ -86,7 +86,7 @@ index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f
return list;
}
@@ -50,6 +70,8 @@ public class BotCommand extends Command {
@@ -51,6 +71,8 @@ public class BotCommand extends Command {
case "remove" -> this.onRemove(sender, args);
@@ -95,7 +95,7 @@ index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f
default -> {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
@@ -61,7 +83,7 @@ public class BotCommand extends Command {
@@ -62,7 +84,7 @@ public class BotCommand extends Command {
private void onCreate(CommandSender sender, String[] args) {
if (args.length < 2) {
@@ -104,7 +104,7 @@ index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f
return;
}
@@ -85,7 +107,7 @@ public class BotCommand extends Command {
@@ -86,7 +108,7 @@ public class BotCommand extends Command {
private void onRemove(CommandSender sender, String[] args) {
if (args.length < 2) {
@@ -113,9 +113,9 @@ index 292fede3bb850892e57640814440bdcebfd43aec..348174882a6ccc64aeda3997d20e5c8f
return;
}
@@ -98,4 +120,31 @@ public class BotCommand extends Command {
@@ -99,4 +121,31 @@ public class BotCommand extends Command {
bot.kill();
bot.die(DamageSource.OUT_OF_WORLD);
}
+
+ private void onAction(CommandSender sender, String[] args) {