Remove the need for AllSpigotNMS

I removed the need for AllSpigotNMS by separating each version implementation in its own maven module. Each of the implementations depend on the NMS version that their implementing for.
This commit is contained in:
SeanOMik 2021-06-23 18:06:43 -04:00
parent fd7812ee31
commit f68aeaa99b
No known key found for this signature in database
GPG Key ID: CA09E5BE1F32728A
56 changed files with 310 additions and 73 deletions

5
.gitignore vendored
View File

@ -1,6 +1,11 @@
# Don't track content of these folders # Don't track content of these folders
.idea/* .idea/*
target/* target/*
1_14_R1/target/*
1_15_R1/target/*
1_16_R1/target/*
1_16_R2/target/*
1_16_R3/target/*
1_17_R1/target/* 1_17_R1/target/*
Plugin/target/* Plugin/target/*
Utility/target/* Utility/target/*

45
1_14_R1/pom.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_14_R1</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-util</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_14_R1; package net.seanomik.tamablefoxes.versions.version_1_14_R1;
import net.minecraft.server.v1_14_R1.*; import net.minecraft.server.v1_14_R1.*;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.util.io.Config; import net.seanomik.tamablefoxes.util.io.Config;
import net.seanomik.tamablefoxes.util.io.LanguageConfig; import net.seanomik.tamablefoxes.util.io.LanguageConfig;
@ -80,7 +79,7 @@ public class EntityTamableFox extends EntityFox {
return !isTamed() && !((EntityLiving) entityliving).isSneaking() && IEntitySelector.e.test((EntityLiving) entityliving) && !this.isDefending(); return !isTamed() && !((EntityLiving) entityliving).isSneaking() && IEntitySelector.e.test((EntityLiving) entityliving) && !this.isDefending();
})); }));
this.goalSelector.a(4, new PathfinderGoalAvoidTarget(this, EntityWolf.class, 8.0F, 1.6D, 1.4D, (entityliving) -> { this.goalSelector.a(4, new PathfinderGoalAvoidTarget(this, EntityWolf.class, 8.0F, 1.6D, 1.4D, (entityliving) -> {
return !((net.minecraft.server.v1_16_R1.EntityWolf)entityliving).isTamed() && !this.isDefending(); return !((EntityWolf)entityliving).isTamed() && !this.isDefending();
})); }));
this.goalSelector.a(5, getFoxInnerPathfinderGoal("u")); // StalkPreyGoal this.goalSelector.a(5, getFoxInnerPathfinderGoal("u")); // StalkPreyGoal
@ -287,7 +286,7 @@ public class EntityTamableFox extends EntityFox {
// Run this task async to make sure to not slow the server down. // Run this task async to make sure to not slow the server down.
// This is needed due to the item being remove as soon as its put in the foxes mouth. // This is needed due to the item being remove as soon as its put in the foxes mouth.
Bukkit.getScheduler().runTaskLaterAsynchronously(TamableFoxes.getPlugin(), ()-> { Bukkit.getScheduler().runTaskLaterAsynchronously(Utils.tamableFoxesPlugin, ()-> {
// Put item in mouth // Put item in mouth
if (item != Items.AIR) { if (item != Items.AIR) {
ItemStack c = itemstack.cloneItemStack(); ItemStack c = itemstack.cloneItemStack();
@ -318,7 +317,7 @@ public class EntityTamableFox extends EntityFox {
itemstack.subtract(1); itemstack.subtract(1);
} }
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
@ -365,7 +364,7 @@ public class EntityTamableFox extends EntityFox {
return AnvilGUI.Response.close(); return AnvilGUI.Response.close();
}) })
.text("Fox name") // Sets the text the GUI should start with .text("Fox name") // Sets the text the GUI should start with
.plugin(TamableFoxes.getPlugin()) // Set the plugin instance .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance
.open(player); // Opens the GUI for the player provided .open(player); // Opens the GUI for the player provided
} }
} else { } else {
@ -499,7 +498,7 @@ public class EntityTamableFox extends EntityFox {
// Remove the amount of foxes the player has tamed if the limit is enabled. // Remove the amount of foxes the player has tamed if the limit is enabled.
if (Config.getMaxPlayerFoxTames() > 0) { if (Config.getMaxPlayerFoxTames() > 0) {
SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1);
} }
} }

View File

@ -1,6 +1,5 @@
package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding; package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding;
import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox;
import net.minecraft.server.v1_14_R1.*; import net.minecraft.server.v1_14_R1.*;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason; import org.bukkit.event.entity.EntityTargetEvent.TargetReason;

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding; package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding;
import net.minecraft.server.v1_14_R1.EntityLiving; import net.minecraft.server.v1_14_R1.EntityLiving;
import net.minecraft.server.v1_14_R1.EntityTameableAnimal;
import net.minecraft.server.v1_14_R1.PathfinderGoalTarget; import net.minecraft.server.v1_14_R1.PathfinderGoalTarget;
import net.minecraft.server.v1_14_R1.PathfinderTargetCondition; import net.minecraft.server.v1_14_R1.PathfinderTargetCondition;
import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox; import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox;

View File

@ -1,11 +1,8 @@
package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding; package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding;
import net.minecraft.server.v1_14_R1.EntityFox;
import net.minecraft.server.v1_14_R1.PathfinderGoalPanic; import net.minecraft.server.v1_14_R1.PathfinderGoalPanic;
import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox; import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox;
import java.lang.reflect.Method;
public class FoxPathfinderGoalPanic extends PathfinderGoalPanic { public class FoxPathfinderGoalPanic extends PathfinderGoalPanic {
EntityTamableFox tamableFox; EntityTamableFox tamableFox;

View File

@ -1,6 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding; package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding;
import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox; 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.EntityLiving;
import net.minecraft.server.v1_14_R1.PathfinderGoal; import net.minecraft.server.v1_14_R1.PathfinderGoal;
@ -39,7 +39,7 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
this.entity.setGoalTarget(null); this.entity.setGoalTarget(null);
// For some reason it needs to be ran later. // For some reason it needs to be ran later.
Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(Utils.tamableFoxesPlugin, () -> {
this.entity.setSitting(true); this.entity.setSitting(true);
}, 1L); }, 1L);
} }

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding; package net.seanomik.tamablefoxes.versions.version_1_14_R1.pathfinding;
import net.minecraft.server.v1_14_R1.*; import net.minecraft.server.v1_14_R1.*;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox; import net.seanomik.tamablefoxes.versions.version_1_14_R1.EntityTamableFox;
import java.util.Iterator; import java.util.Iterator;

45
1_15_R1/pom.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_15_R1</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-util</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_15_R1; package net.seanomik.tamablefoxes.versions.version_1_15_R1;
import net.minecraft.server.v1_15_R1.*; import net.minecraft.server.v1_15_R1.*;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.util.io.Config; import net.seanomik.tamablefoxes.util.io.Config;
import net.seanomik.tamablefoxes.util.io.LanguageConfig; import net.seanomik.tamablefoxes.util.io.LanguageConfig;
@ -287,7 +286,7 @@ public class EntityTamableFox extends EntityFox {
// Run this task async to make sure to not slow the server down. // Run this task async to make sure to not slow the server down.
// This is needed due to the item being remove as soon as its put in the foxes mouth. // This is needed due to the item being remove as soon as its put in the foxes mouth.
Bukkit.getScheduler().runTaskLaterAsynchronously(TamableFoxes.getPlugin(), ()-> { Bukkit.getScheduler().runTaskLaterAsynchronously(Utils.tamableFoxesPlugin, ()-> {
// Put item in mouth // Put item in mouth
if (item != Items.AIR) { if (item != Items.AIR) {
ItemStack c = itemstack.cloneItemStack(); ItemStack c = itemstack.cloneItemStack();
@ -318,7 +317,7 @@ public class EntityTamableFox extends EntityFox {
itemstack.subtract(1); itemstack.subtract(1);
} }
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
@ -365,7 +364,7 @@ public class EntityTamableFox extends EntityFox {
return AnvilGUI.Response.close(); return AnvilGUI.Response.close();
}) })
.text("Fox name") // Sets the text the GUI should start with .text("Fox name") // Sets the text the GUI should start with
.plugin(TamableFoxes.getPlugin()) // Set the plugin instance .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance
.open(player); // Opens the GUI for the player provided .open(player); // Opens the GUI for the player provided
} }
} else { } else {
@ -499,7 +498,7 @@ public class EntityTamableFox extends EntityFox {
// Remove the amount of foxes the player has tamed if the limit is enabled. // Remove the amount of foxes the player has tamed if the limit is enabled.
if (Config.getMaxPlayerFoxTames() > 0) { if (Config.getMaxPlayerFoxTames() > 0) {
SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1);
} }
} }

View File

@ -1,6 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_15_R1.pathfinding; package net.seanomik.tamablefoxes.versions.version_1_15_R1.pathfinding;
import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.versions.version_1_15_R1.EntityTamableFox; 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.EntityLiving;
import net.minecraft.server.v1_15_R1.PathfinderGoal; import net.minecraft.server.v1_15_R1.PathfinderGoal;
@ -40,7 +40,7 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
this.entity.setGoalTarget(null); this.entity.setGoalTarget(null);
// For some reason it needs to be ran later. // For some reason it needs to be ran later.
Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(Utils.tamableFoxesPlugin, () -> {
this.entity.setSitting(true); this.entity.setSitting(true);
}, 1L); }, 1L);
} }

45
1_16_R1/pom.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_16_R1</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-util</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_16_R1; package net.seanomik.tamablefoxes.versions.version_1_16_R1;
import net.minecraft.server.v1_16_R1.*; import net.minecraft.server.v1_16_R1.*;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.util.io.Config; import net.seanomik.tamablefoxes.util.io.Config;
import net.seanomik.tamablefoxes.util.io.LanguageConfig; import net.seanomik.tamablefoxes.util.io.LanguageConfig;
@ -289,7 +288,7 @@ public class EntityTamableFox extends EntityFox {
// Run this task async to make sure to not slow the server down. // Run this task async to make sure to not slow the server down.
// This is needed due to the item being remove as soon as its put in the foxes mouth. // This is needed due to the item being remove as soon as its put in the foxes mouth.
Bukkit.getScheduler().runTaskLaterAsynchronously(TamableFoxes.getPlugin(), ()-> { Bukkit.getScheduler().runTaskLaterAsynchronously(Utils.tamableFoxesPlugin, ()-> {
// Put item in mouth // Put item in mouth
if (item != Items.AIR) { if (item != Items.AIR) {
ItemStack c = itemstack.cloneItemStack(); ItemStack c = itemstack.cloneItemStack();
@ -321,7 +320,7 @@ public class EntityTamableFox extends EntityFox {
itemstack.subtract(1); itemstack.subtract(1);
} }
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
@ -368,7 +367,7 @@ public class EntityTamableFox extends EntityFox {
return AnvilGUI.Response.close(); return AnvilGUI.Response.close();
}) })
.text("Fox name") // Sets the text the GUI should start with .text("Fox name") // Sets the text the GUI should start with
.plugin(TamableFoxes.getPlugin()) // Set the plugin instance .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance
.open(player); // Opens the GUI for the player provided .open(player); // Opens the GUI for the player provided
} }
} else { } else {
@ -503,7 +502,7 @@ public class EntityTamableFox extends EntityFox {
// Remove the amount of foxes the player has tamed if the limit is enabled. // Remove the amount of foxes the player has tamed if the limit is enabled.
if (Config.getMaxPlayerFoxTames() > 0) { if (Config.getMaxPlayerFoxTames() > 0) {
SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1);
} }
} }

View File

@ -2,7 +2,7 @@ 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.PathfinderGoal;
import net.minecraft.server.v1_16_R1.EntityLiving; import net.minecraft.server.v1_16_R1.EntityLiving;
import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.versions.version_1_16_R1.EntityTamableFox; import net.seanomik.tamablefoxes.versions.version_1_16_R1.EntityTamableFox;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -39,7 +39,7 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
this.entity.setGoalTarget(null); this.entity.setGoalTarget(null);
// For some reason it needs to be ran later. // For some reason it needs to be ran later.
Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(Utils.tamableFoxesPlugin, () -> {
this.entity.setSitting(true); this.entity.setSitting(true);
}, 1L); }, 1L);
} }

45
1_16_R2/pom.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>tamablefoxes-parent</artifactId>
<groupId>net.seanomik</groupId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_16_R2</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-util</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_16_R2; package net.seanomik.tamablefoxes.versions.version_1_16_R2;
import net.minecraft.server.v1_16_R2.*; import net.minecraft.server.v1_16_R2.*;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.util.io.Config; import net.seanomik.tamablefoxes.util.io.Config;
import net.seanomik.tamablefoxes.util.io.LanguageConfig; import net.seanomik.tamablefoxes.util.io.LanguageConfig;
@ -286,7 +285,7 @@ public class EntityTamableFox extends EntityFox {
// Run this task async to make sure to not slow the server down. // Run this task async to make sure to not slow the server down.
// This is needed due to the item being remove as soon as its put in the foxes mouth. // This is needed due to the item being remove as soon as its put in the foxes mouth.
Bukkit.getScheduler().runTaskLaterAsynchronously(TamableFoxes.getPlugin(), ()-> { Bukkit.getScheduler().runTaskLaterAsynchronously(Utils.tamableFoxesPlugin, ()-> {
// Put item in mouth // Put item in mouth
if (item != Items.AIR) { if (item != Items.AIR) {
ItemStack c = itemstack.cloneItemStack(); ItemStack c = itemstack.cloneItemStack();
@ -318,7 +317,7 @@ public class EntityTamableFox extends EntityFox {
itemstack.subtract(1); itemstack.subtract(1);
} }
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
@ -365,7 +364,7 @@ public class EntityTamableFox extends EntityFox {
return AnvilGUI.Response.close(); return AnvilGUI.Response.close();
}) })
.text("Fox name") // Sets the text the GUI should start with .text("Fox name") // Sets the text the GUI should start with
.plugin(TamableFoxes.getPlugin()) // Set the plugin instance .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance
.open(player); // Opens the GUI for the player provided .open(player); // Opens the GUI for the player provided
} }
} else { } else {
@ -500,7 +499,7 @@ public class EntityTamableFox extends EntityFox {
// Remove the amount of foxes the player has tamed if the limit is enabled. // Remove the amount of foxes the player has tamed if the limit is enabled.
if (Config.getMaxPlayerFoxTames() > 0) { if (Config.getMaxPlayerFoxTames() > 0) {
SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1);
} }
} }

View File

@ -2,7 +2,7 @@ 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.EntityLiving;
import net.minecraft.server.v1_16_R2.PathfinderGoal; import net.minecraft.server.v1_16_R2.PathfinderGoal;
import net.seanomik.tamablefoxes.TamableFoxes; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.versions.version_1_16_R2.EntityTamableFox; import net.seanomik.tamablefoxes.versions.version_1_16_R2.EntityTamableFox;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -39,7 +39,7 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
this.entity.setGoalTarget(null); this.entity.setGoalTarget(null);
// For some reason it needs to be ran later. // For some reason it needs to be ran later.
Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(Utils.tamableFoxesPlugin, () -> {
this.entity.setSitting(true); this.entity.setSitting(true);
}, 1L); }, 1L);
} }

45
1_16_R3/pom.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>tamablefoxes_v1_16_R3</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-util</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -1,7 +1,6 @@
package net.seanomik.tamablefoxes.versions.version_1_16_R3; package net.seanomik.tamablefoxes.versions.version_1_16_R3;
import net.minecraft.server.v1_16_R3.*; import net.minecraft.server.v1_16_R3.*;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.util.io.Config; import net.seanomik.tamablefoxes.util.io.Config;
import net.seanomik.tamablefoxes.util.io.LanguageConfig; import net.seanomik.tamablefoxes.util.io.LanguageConfig;
@ -287,7 +286,7 @@ public class EntityTamableFox extends EntityFox {
// Run this task async to make sure to not slow the server down. // Run this task async to make sure to not slow the server down.
// This is needed due to the item being remove as soon as its put in the foxes mouth. // This is needed due to the item being remove as soon as its put in the foxes mouth.
Bukkit.getScheduler().runTaskLaterAsynchronously(TamableFoxes.getPlugin(), ()-> { Bukkit.getScheduler().runTaskLaterAsynchronously(Utils.tamableFoxesPlugin, ()-> {
// Put item in mouth // Put item in mouth
if (item != Items.AIR) { if (item != Items.AIR) {
ItemStack c = itemstack.cloneItemStack(); ItemStack c = itemstack.cloneItemStack();
@ -319,7 +318,7 @@ public class EntityTamableFox extends EntityFox {
itemstack.subtract(1); itemstack.subtract(1);
} }
SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqLiteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
int maxTameCount = Config.getMaxPlayerFoxTames(); int maxTameCount = Config.getMaxPlayerFoxTames();
if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) { if ( !((Player) entityhuman.getBukkitEntity()).hasPermission("tamablefoxes.tame.unlimited") && maxTameCount > 0 && sqLiteHelper.getPlayerFoxAmount(entityhuman.getUniqueID()) >= maxTameCount) {
((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust()); ((Player) entityhuman.getBukkitEntity()).sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFoxDoesntTrust());
@ -366,7 +365,7 @@ public class EntityTamableFox extends EntityFox {
return AnvilGUI.Response.close(); return AnvilGUI.Response.close();
}) })
.text("Fox name") // Sets the text the GUI should start with .text("Fox name") // Sets the text the GUI should start with
.plugin(TamableFoxes.getPlugin()) // Set the plugin instance .plugin(Utils.tamableFoxesPlugin) // Set the plugin instance
.open(player); // Opens the GUI for the player provided .open(player); // Opens the GUI for the player provided
} }
} else { } else {
@ -501,7 +500,7 @@ public class EntityTamableFox extends EntityFox {
// Remove the amount of foxes the player has tamed if the limit is enabled. // Remove the amount of foxes the player has tamed if the limit is enabled.
if (Config.getMaxPlayerFoxTames() > 0) { if (Config.getMaxPlayerFoxTames() > 0) {
SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(TamableFoxes.getPlugin()); SQLiteHelper sqliteHelper = SQLiteHelper.getInstance(Utils.tamableFoxesPlugin);
sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1); sqliteHelper.removePlayerFoxAmount(this.getOwner().getUniqueID(), 1);
} }
} }

View File

@ -2,16 +2,11 @@ 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.EntityLiving;
import net.minecraft.server.v1_16_R3.PathfinderGoal; import net.minecraft.server.v1_16_R3.PathfinderGoal;
import net.minecraft.server.v1_16_R3.Vec3D; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.versions.version_1_16_R3.EntityTamableFox; import net.seanomik.tamablefoxes.versions.version_1_16_R3.EntityTamableFox;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.util.Vector;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
public class FoxPathfinderGoalSit extends PathfinderGoal { public class FoxPathfinderGoalSit extends PathfinderGoal {
private final EntityTamableFox entity; private final EntityTamableFox entity;
@ -44,7 +39,7 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
this.entity.setGoalTarget(null); this.entity.setGoalTarget(null);
// For some reason it needs to be ran later. // For some reason it needs to be ran later.
Bukkit.getScheduler().runTaskLater(TamableFoxes.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(Utils.tamableFoxesPlugin, () -> {
this.entity.setSitting(true); this.entity.setSitting(true);
}, 1L); }, 1L);
} }

Binary file not shown.

Binary file not shown.

View File

@ -2,30 +2,27 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-parent</artifactId> <artifactId>tamablefoxes-parent</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes</artifactId> <artifactId>tamablefoxes</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Tamablefoxes</name> <name>Tamablefoxes</name>
<properties> <properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<server.version>1.17</server.version> <server.version>1.17</server.version>
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin> <!--<plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
@ -33,11 +30,10 @@
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
</configuration> </configuration>
</plugin> </plugin>-->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -45,7 +41,7 @@
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<outputFile>D:\Code\java\spigotPlugins\servers\${server.version}\plugins\TamableFoxes_v${project.version}.jar</outputFile> <outputFile>D:\Code\java\spigotPlugins\servers\${server.version}\plugins\TamableFoxes_v${project.parent.version}.jar</outputFile>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
</configuration> </configuration>
</execution> </execution>
@ -84,9 +80,34 @@
</repositories> </repositories>
<dependencies> <dependencies>
<!-- Entity implementations -->
<dependency> <dependency>
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>tamablefoxes-util</artifactId> <artifactId>tamablefoxes_v1_14_R1</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes_v1_15_R1</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes_v1_16_R1</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes_v1_16_R2</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.seanomik</groupId>
<artifactId>tamablefoxes_v1_16_R3</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -96,15 +117,14 @@
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- End of entity implementations -->
<dependency> <dependency>
<groupId>local.spigot.nms</groupId> <groupId>net.seanomik</groupId>
<artifactId>AllSpigotNMS</artifactId> <artifactId>tamablefoxes-util</artifactId>
<version>LATEST</version> <version>${project.parent.version}</version>
<scope>system</scope> <scope>compile</scope>
<systemPath>${project.basedir}/Spigot_v14_v15_v16-v165.jar</systemPath>
</dependency> </dependency>
<!-- We need to do this so we get the spigot api without nms. --> <dependency> <!-- We need to do this so we get the spigot api without nms. -->
<dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.14-R0.1-SNAPSHOT</version> <version>1.14-R0.1-SNAPSHOT</version>

View File

@ -1,6 +1,5 @@
package net.seanomik.tamablefoxes; package net.seanomik.tamablefoxes;
import net.seanomik.tamablefoxes.versions.version_1_17_R1.NMSInterface_1_17_R1;
import net.seanomik.tamablefoxes.util.NMSInterface; import net.seanomik.tamablefoxes.util.NMSInterface;
import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.Utils;
import net.seanomik.tamablefoxes.util.io.Config; import net.seanomik.tamablefoxes.util.io.Config;
@ -10,6 +9,7 @@ import net.seanomik.tamablefoxes.versions.version_1_15_R1.NMSInterface_1_15_R1;
import net.seanomik.tamablefoxes.versions.version_1_16_R1.NMSInterface_1_16_R1; import net.seanomik.tamablefoxes.versions.version_1_16_R1.NMSInterface_1_16_R1;
import net.seanomik.tamablefoxes.versions.version_1_16_R2.NMSInterface_1_16_R2; import net.seanomik.tamablefoxes.versions.version_1_16_R2.NMSInterface_1_16_R2;
import net.seanomik.tamablefoxes.versions.version_1_16_R3.NMSInterface_1_16_R3; import net.seanomik.tamablefoxes.versions.version_1_16_R3.NMSInterface_1_16_R3;
import net.seanomik.tamablefoxes.versions.version_1_17_R1.NMSInterface_1_17_R1;
import net.seanomik.tamablefoxes.util.io.LanguageConfig; import net.seanomik.tamablefoxes.util.io.LanguageConfig;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

21
pom.xml
View File

@ -13,13 +13,14 @@
<module>Plugin</module> <module>Plugin</module>
<module>Utility</module> <module>Utility</module>
<module>1_17_R1</module> <module>1_17_R1</module>
<module>1_16_R3</module>
<module>1_16_R2</module>
<module>1_16_R1</module>
<module>1_15_R1</module>
<module>1_14_R1</module>
</modules> </modules>
<properties> <properties>
<maven.compiler.target>16</maven.compiler.target>
<maven.compiler.source>16</maven.compiler.source>
<!--<java.version.source>16</java.version.source>
<java.version.target>16</java.version.target>-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
@ -30,10 +31,13 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<!--<configuration> <configuration>
<source>${java.version.source}</source> <source>1.8</source>
<target>${java.version.target}</target> <target>1.8</target>
</configuration>--> <compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -51,5 +55,4 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
</project> </project>