diff --git a/pom.xml b/pom.xml index 54557f2..b908562 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.seanomik tamablefoxes - 1.8-SNAPSHOT + 1.8.1-SNAPSHOT jar Tamablefoxes @@ -46,7 +46,8 @@ - D:\Code\java\spigotPlugins\_TEST_SERVER_1.16.4_\plugins\TamableFoxes_v${project.version}.jar + + D:\Code\java\spigotPlugins\_TEST_SERVER_PAPER_1.16.4_\plugins\TamableFoxes_v${project.version}.jar false diff --git a/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java b/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java index 9686079..446f1bc 100644 --- a/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java +++ b/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java @@ -16,8 +16,8 @@ import org.bukkit.plugin.java.JavaPlugin; // @TODO: -/* @CHANGELOG (1.7.9-SNAPSHOT): - * Fix some crashes and errors with the sqlite database failing to be found. +/* @CHANGELOG (1.8.1-SNAPSHOT): + * Fixes #32. Kinda hacky but will work for now */ public final class TamableFoxes extends JavaPlugin implements Listener { private static TamableFoxes plugin; @@ -52,6 +52,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener { break; default: Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionRegister()); + Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + "You're trying to run MC version " + version + " which is not supported!"); versionSupported = false; return; } diff --git a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/pathfinding/FoxPathfinderGoalSit.java b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/pathfinding/FoxPathfinderGoalSit.java index 2fed36d..bd42556 100644 --- a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/pathfinding/FoxPathfinderGoalSit.java +++ b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_14_R1/pathfinding/FoxPathfinderGoalSit.java @@ -1,8 +1,10 @@ package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding; +import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox; import net.minecraft.server.v1_14_R1.EntityLiving; import net.minecraft.server.v1_14_R1.PathfinderGoal; +import org.bukkit.Bukkit; import java.util.EnumSet; @@ -34,7 +36,12 @@ public class FoxPathfinderGoalSit extends PathfinderGoal { public void c() { this.entity.getNavigation().o(); - this.entity.setSitting(true); + this.entity.setGoalTarget(null); + + // For some reason it needs to be ran later. + Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { + this.entity.setSitting(true); + }, 1L); } public void d() { diff --git a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/pathfinding/FoxPathfinderGoalSit.java b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/pathfinding/FoxPathfinderGoalSit.java index 24cdb0d..76a7526 100644 --- a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/pathfinding/FoxPathfinderGoalSit.java +++ b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_15_R1/pathfinding/FoxPathfinderGoalSit.java @@ -1,8 +1,10 @@ package net.seanomik.tamablefoxes.versions.version_1_15_R1.pathfinding; +import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.versions.version_1_15_R1.EntityTamableFox; import net.minecraft.server.v1_15_R1.EntityLiving; import net.minecraft.server.v1_15_R1.PathfinderGoal; +import org.bukkit.Bukkit; import java.util.EnumSet; @@ -35,7 +37,12 @@ public class FoxPathfinderGoalSit extends PathfinderGoal { public void c() { this.entity.getNavigation().o(); - this.entity.setSitting(true); + this.entity.setGoalTarget(null); + + // For some reason it needs to be ran later. + Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { + this.entity.setSitting(true); + }, 1L); } public void d() { diff --git a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/pathfinding/FoxPathfinderGoalSit.java b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/pathfinding/FoxPathfinderGoalSit.java index e56acad..02df520 100644 --- a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/pathfinding/FoxPathfinderGoalSit.java +++ b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R1/pathfinding/FoxPathfinderGoalSit.java @@ -2,7 +2,9 @@ package net.seanomik.tamablefoxes.versions.version_1_16_R1.pathfinding; import net.minecraft.server.v1_16_R1.PathfinderGoal; import net.minecraft.server.v1_16_R1.EntityLiving; +import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.versions.version_1_16_R1.EntityTamableFox; +import org.bukkit.Bukkit; import java.util.EnumSet; @@ -28,13 +30,18 @@ public class FoxPathfinderGoalSit extends PathfinderGoal { return false; } else { EntityLiving entityliving = this.entity.getOwner(); - return entityliving == null ? true : (this.entity.h(entityliving) < 144.0D && entityliving.getLastDamager() != null ? false : this.willSit); // this.entity.isWillSit() + return entityliving == null || ((!(this.entity.h(entityliving) < 144.0D) || entityliving.getLastDamager() == null) && this.willSit); // this.entity.isWillSit() } } public void c() { this.entity.getNavigation().o(); - this.entity.setSitting(true); + this.entity.setGoalTarget(null); + + // For some reason it needs to be ran later. + Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { + this.entity.setSitting(true); + }, 1L); } public void d() { diff --git a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/pathfinding/FoxPathfinderGoalSit.java b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/pathfinding/FoxPathfinderGoalSit.java index 0317e5d..2a4078c 100644 --- a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/pathfinding/FoxPathfinderGoalSit.java +++ b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R2/pathfinding/FoxPathfinderGoalSit.java @@ -2,7 +2,9 @@ package net.seanomik.tamablefoxes.versions.version_1_16_R2.pathfinding; import net.minecraft.server.v1_16_R2.EntityLiving; import net.minecraft.server.v1_16_R2.PathfinderGoal; +import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.versions.version_1_16_R2.EntityTamableFox; +import org.bukkit.Bukkit; import java.util.EnumSet; @@ -28,13 +30,18 @@ public class FoxPathfinderGoalSit extends PathfinderGoal { return false; } else { EntityLiving entityliving = this.entity.getOwner(); - return entityliving == null ? true : (this.entity.h(entityliving) < 144.0D && entityliving.getLastDamager() != null ? false : this.willSit); // this.entity.isWillSit() + return entityliving == null || ((!(this.entity.h(entityliving) < 144.0D) || entityliving.getLastDamager() == null) && this.willSit); // this.entity.isWillSit() } } public void c() { this.entity.getNavigation().o(); - this.entity.setSitting(true); + this.entity.setGoalTarget(null); + + // For some reason it needs to be ran later. + Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { + this.entity.setSitting(true); + }, 1L); } public void d() { diff --git a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/pathfinding/FoxPathfinderGoalSit.java b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/pathfinding/FoxPathfinderGoalSit.java index 62f12b0..1a3c68e 100644 --- a/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/pathfinding/FoxPathfinderGoalSit.java +++ b/src/main/java/net/seanomik/tamablefoxes/versions/version_1_16_R3/pathfinding/FoxPathfinderGoalSit.java @@ -2,9 +2,16 @@ package net.seanomik.tamablefoxes.versions.version_1_16_R3.pathfinding; import net.minecraft.server.v1_16_R3.EntityLiving; import net.minecraft.server.v1_16_R3.PathfinderGoal; +import net.minecraft.server.v1_16_R3.Vec3D; +import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.versions.version_1_16_R3.EntityTamableFox; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.util.Vector; import java.util.EnumSet; +import java.util.LinkedList; +import java.util.List; public class FoxPathfinderGoalSit extends PathfinderGoal { private final EntityTamableFox entity; @@ -17,24 +24,29 @@ public class FoxPathfinderGoalSit extends PathfinderGoal { public boolean b() { return this.willSit; - } // return this.entity.isWillSit(); + } public boolean a() { if (!this.entity.isTamed()) { - return this.willSit && this.entity.getGoalTarget() == null; // this.entity.isWillSit() + return this.willSit && this.entity.getGoalTarget() == null; } else if (this.entity.aG()) { return false; } else if (!this.entity.isOnGround()) { return false; } else { EntityLiving entityliving = this.entity.getOwner(); - return entityliving == null ? true : (this.entity.h(entityliving) < 144.0D && entityliving.getLastDamager() != null ? false : this.willSit); // this.entity.isWillSit() + return entityliving == null || ((!(this.entity.h(entityliving) < 144.0D) || entityliving.getLastDamager() == null) && this.willSit); } } public void c() { this.entity.getNavigation().o(); - this.entity.setSitting(true); + this.entity.setGoalTarget(null); + + // For some reason it needs to be ran later. + Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { + this.entity.setSitting(true); + }, 1L); } public void d() { diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index 2036488..2f90b1e 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -1,6 +1,6 @@ mc-version-loading: "Registering entity for MC Version %MC_VERSION%..." -unsupported-mc-version-not-registering: "ERROR: This plugin version only supports Spigot 1.15.X! Not registering entity! Make sure your Java version is no newer than Java 11!" -unsupported-mc-version-disabling: "This plugin version only supports Spigot 1.14-1.16.2! Disabling plugin! Make sure your Java version is no newer than Java 11!" +unsupported-mc-version-not-registering: "ERROR: This plugin version only supports Spigot 1.14-1.16.4! Not registering entity! Make sure your Java version is no newer than Java 11!" +unsupported-mc-version-disabling: "This plugin version only supports Spigot 1.14-1.16.4! Disabling plugin! Make sure your Java version is no newer than Java 11!" success-replaced-entity: "Replaced tamable fox entity!" error-to-replaced-entity: "Failed to replace tamable fox entity!" saving-foxes-message: "Saving foxes."