Skip to content

Commit

Permalink
resolve import
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumine1909 committed Jul 1, 2024
1 parent 6a9e4e9 commit 3ae8f54
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions patches/server/0010-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ index bb9383f1a457433f9db3e78d7913616280925200..55b41ca7630db143d70137324a9de871
*/
diff --git a/src/main/java/org/leavesmc/leaves/bot/BotCommand.java b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..54b5d2911b35964d95b9f2b46f80041141a92169
index 0000000000000000000000000000000000000000..ee53eb3bc9a0299f8438d8a650ce39b80f35192b
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java
@@ -0,0 +1,405 @@
@@ -0,0 +1,407 @@
+package org.leavesmc.leaves.bot;
+
+import org.bukkit.Bukkit;
Expand All @@ -404,6 +404,8 @@ index 0000000000000000000000000000000000000000..54b5d2911b35964d95b9f2b46f800411
+import org.leavesmc.leaves.entity.Bot;
+import org.leavesmc.leaves.event.bot.BotActionEvent;
+import org.leavesmc.leaves.event.bot.BotConfigModifyEvent;
+import org.leavesmc.leaves.event.bot.BotCreateEvent;
+import org.leavesmc.leaves.event.bot.BotRemoveEvent;
+
+import java.util.ArrayList;
+import java.util.HashMap;
Expand Down Expand Up @@ -522,7 +524,7 @@ index 0000000000000000000000000000000000000000..54b5d2911b35964d95b9f2b46f800411
+
+ if (canCreate(sender, args[1])) {
+ if (sender instanceof Player player) {
+ new ServerBot.BotCreateState(player.getLocation(), args[1], args.length < 3 ? args[1] : args[2], org.leavesmc.leaves.event.bot.BotCreateEvent.CreateReason.COMMAND, player).createAsync(bot -> bot.createPlayer = player.getUniqueId());
+ new ServerBot.BotCreateState(player.getLocation(), args[1], args.length < 3 ? args[1] : args[2], BotCreateEvent.CreateReason.COMMAND, player).createAsync(bot -> bot.createPlayer = player.getUniqueId());
+ } else if (sender instanceof ConsoleCommandSender csender) {
+ if (args.length < 6) {
+ sender.sendMessage(ChatColor.RED + "Use /bot create <name> <skin_name> <bukkit_world_name> <x> <y> <z> to create a fakeplayer");
Expand All @@ -536,7 +538,7 @@ index 0000000000000000000000000000000000000000..54b5d2911b35964d95b9f2b46f800411
+ double z = Double.parseDouble(args[6]);
+
+ if (world != null) {
+ new ServerBot.BotCreateState(new Location(world, x, y, z), args[1], args[2], org.leavesmc.leaves.event.bot.BotCreateEvent.CreateReason.COMMAND, csender).createAsync(null);
+ new ServerBot.BotCreateState(new Location(world, x, y, z), args[1], args[2], BotCreateEvent.CreateReason.COMMAND, csender).createAsync(null);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
Expand Down Expand Up @@ -582,7 +584,7 @@ index 0000000000000000000000000000000000000000..54b5d2911b35964d95b9f2b46f800411
+ return;
+ }
+
+ bot.onRemove(org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.COMMAND, sender);
+ bot.onRemove(BotRemoveEvent.RemoveReason.COMMAND, sender);
+ }
+
+ private void onAction(CommandSender sender, String @NotNull [] args) {
Expand Down Expand Up @@ -1265,10 +1267,10 @@ index 0000000000000000000000000000000000000000..0db337866c71283464d026a4f230016b
+}
diff --git a/src/main/java/org/leavesmc/leaves/bot/ServerBot.java b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java
new file mode 100644
index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b335941348d151
index 0000000000000000000000000000000000000000..dd1b8974825781fb34be6faae1da4bb35a1edfe6
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java
@@ -0,0 +1,743 @@
@@ -0,0 +1,745 @@
+package org.leavesmc.leaves.bot;
+
+import com.google.common.collect.Lists;
Expand Down Expand Up @@ -1320,6 +1322,7 @@ index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b33594
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.command.CommandSender;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.scheduler.CraftScheduler;
+import org.bukkit.event.entity.CreatureSpawnEvent;
Expand All @@ -1335,6 +1338,7 @@ index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b33594
+import org.leavesmc.leaves.event.bot.BotCreateEvent;
+import org.leavesmc.leaves.event.bot.BotInventoryOpenEvent;
+import org.leavesmc.leaves.event.bot.BotJoinEvent;
+import org.leavesmc.leaves.event.bot.BotRemoveEvent;
+import org.leavesmc.leaves.util.MathUtils;
+
+import java.io.BufferedReader;
Expand Down Expand Up @@ -1525,16 +1529,16 @@ index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b33594
+ public void die(@NotNull DamageSource damageSource) {
+ super.die(damageSource);
+ if (removeOnDeath) {
+ onRemove(org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.DEATH);
+ onRemove(BotRemoveEvent.RemoveReason.DEATH);
+ }
+ }
+
+ public void onRemove(org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason reason) {
+ public void onRemove(BotRemoveEvent.RemoveReason reason) {
+ onRemove(reason, null);
+ }
+
+ public void onRemove(org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason reason, @Nullable org.bukkit.command.CommandSender remover) {
+ if (!new org.leavesmc.leaves.event.bot.BotRemoveEvent(this.getBukkitPlayer(), reason, remover).callEvent()) {
+ public void onRemove(BotRemoveEvent.RemoveReason reason, @Nullable CommandSender remover) {
+ if (!new BotRemoveEvent(this.getBukkitPlayer(), reason, remover).callEvent()) {
+ return;
+ }
+ bots.remove(this);
Expand Down Expand Up @@ -1890,7 +1894,7 @@ index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b33594
+ e.printStackTrace();
+ }
+ } else {
+ removeAllBot(org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL);
+ removeAllBot(BotRemoveEvent.RemoveReason.INTERNAL);
+ }
+ }
+
Expand All @@ -1913,7 +1917,7 @@ index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b33594
+ }
+ }
+
+ public static boolean removeAllBot(org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason reason) {
+ public static boolean removeAllBot(BotRemoveEvent.RemoveReason reason) {
+ Iterator<ServerBot> iterator = bots.iterator();
+ while (iterator.hasNext()) {
+ ServerBot bot = iterator.next();
Expand Down Expand Up @@ -1950,20 +1954,20 @@ index 0000000000000000000000000000000000000000..5dd6778347c121f0b0817e2395b33594
+ private String realName;
+ private String name;
+
+ public org.leavesmc.leaves.event.bot.BotCreateEvent.CreateReason createReason;
+ public org.bukkit.command.CommandSender creator;
+ public BotCreateEvent.CreateReason createReason;
+ public CommandSender creator;
+
+ public boolean async;
+
+ public BotCreateState(Location loc, String realName, String skinName, org.leavesmc.leaves.event.bot.BotCreateEvent.CreateReason createReason, org.bukkit.command.CommandSender creator) {
+ public BotCreateState(Location loc, String realName, String skinName, BotCreateEvent.CreateReason createReason, CommandSender creator) {
+ this.loc = loc;
+ this.skinName = skinName;
+ this.setRealName(realName);
+ this.createReason = createReason;
+ this.creator = creator;
+ }
+
+ public BotCreateState(Location loc, String name, String realName, String skinName, String[] skin, org.leavesmc.leaves.event.bot.BotCreateEvent.CreateReason createReason, org.bukkit.command.CommandSender creator) {
+ public BotCreateState(Location loc, String name, String realName, String skinName, String[] skin, BotCreateEvent.CreateReason createReason, CommandSender creator) {
+ this.loc = loc;
+ this.skinName = skinName;
+ this.skin = skin;
Expand Down

0 comments on commit 3ae8f54

Please sign in to comment.