This commit is contained in:
mfnalex 2023-04-01 17:41:47 +02:00
parent 1300762753
commit 72c4ac8453
7 changed files with 27 additions and 28 deletions

View File

@ -1,3 +1,8 @@
## 2.2.3
- Minor optimizations
- Fixed loyalty tridents entering portals despite being disabled in the config
- Fixed tridents with loyalty already returning to player at Y=-60
## 2.1.1
- Improved void saving in 1.17+

17
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>de.jeff_media</groupId>
<name>BetterTridents</name>
<artifactId>BetterTridents</artifactId>
<version>2.2.2</version>
<version>2.2.3</version>
<properties>
<spigot.prefix>${project.name}</spigot.prefix>
@ -27,19 +27,12 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<!-- Using the maven-shade-plugin to shade and relocate the UpdateChecker -->
<!-- Replace "your.package" with your plugin's package name -->
@ -56,7 +49,7 @@
<shadedPattern>de.jeff_media.bettertridents.lib.org.codehaus</shadedPattern>
</relocation>
<relocation>
<pattern>de.jeff_media.jefflib</pattern>
<pattern>com.jeff_media.jefflib</pattern>
<shadedPattern>de.jeff_media.bettertridents.jefflib</shadedPattern>
</relocation>
</relocations>
@ -127,9 +120,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.jeff_media</groupId>
<groupId>com.jeff_media</groupId>
<artifactId>JeffLib</artifactId>
<version>7.6.0-SNAPSHOT</version>
<version>12.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -19,7 +19,7 @@ import java.util.UUID;
public class Main extends JavaPlugin {
private static Main instance;
private final ArrayList<UUID> tridents = new ArrayList<>();
//private final ArrayList<UUID> tridents = new ArrayList<>();
public static NamespacedKey LOYALTY_TAG;
public static NamespacedKey IMPALING_TAG;
public static NamespacedKey OFFHAND_TAG;
@ -56,7 +56,7 @@ public class Main extends JavaPlugin {
reloadConfig();
new Config();
ConfigUpdater.updateConfig();
UpdateChecker.init(this, "https://api.jeff-media.de/notridentvoid/latest-version.txt")
UpdateChecker.init(this, "https://api.jeff-media.com/notridentvoid/latest-version.txt")
.setDonationLink("https://paypal.me/mfnalex")
.setDownloadLink(92656)
.setChangelogLink(92656)
@ -73,11 +73,11 @@ public class Main extends JavaPlugin {
}
}
public void setLoyal(Trident trident) {
tridents.add(trident.getUniqueId());
}
public void removeLoyal(Trident trident) {
tridents.remove(trident.getUniqueId());
}
// public void setLoyal(Trident trident) {
// tridents.add(trident.getUniqueId());
// }
//
// public void removeLoyal(Trident trident) {
// tridents.remove(trident.getUniqueId());
// }
}

View File

@ -19,7 +19,7 @@ public class PortalListener implements Listener {
if(!main.getConfig().getBoolean(Config.DISABLE_LOYALTY_PORTALS)) return;
if(event.getEntityType() != EntityType.TRIDENT) return;
Trident trident = (Trident) event.getEntity();
if(EnchantmentUtils.getLoyalty(trident)) {
if(EnchantmentUtils.hasLoyalty(trident)) {
main.debug("Prevented loyalty trident from travelling through portal");
event.setCancelled(true);
}

View File

@ -83,10 +83,10 @@ public class TridentThrowListener implements Listener {
main.debug("Void Saving disabled");
return;
}
main.setLoyal(trident);
//main.setLoyal(trident);
main.debug("New task: WatchTrident");
new WatchTrident(trident).runTaskTimer(main,1,1);
Bukkit.getScheduler().runTaskLater(main,() ->main.removeLoyal(trident),1200);
//Bukkit.getScheduler().runTaskLater(main,() ->main.removeLoyal(trident),1200);
}
}

View File

@ -1,7 +1,8 @@
package de.jeff_media.bettertridents.tasks;
import com.jeff_media.jefflib.WorldUtils;
import de.jeff_media.bettertridents.Main;
import de.jeff_media.jefflib.ReflUtils;
import com.jeff_media.jefflib.ReflUtils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Trident;
@ -42,7 +43,7 @@ public class WatchTrident extends BukkitRunnable {
} catch (Exception e) {
damageDealtField = null;
getHandleMethod = null;
e.printStackTrace();
//e.printStackTrace();
}
if (fieldCount == 1) {
@ -78,7 +79,7 @@ public class WatchTrident extends BukkitRunnable {
}
private void rescue() {
if (trident.getLocation().getY() >= -60) return;
if (trident.getLocation().getY() >= WorldUtils.getWorldMinHeight(trident.getWorld()) - 20) return;
try {
damageDealtField.set(getHandleMethod.invoke(trident), true);
} catch (Exception e) {

View File

@ -34,7 +34,7 @@ public class EnchantmentUtils {
trident.getPersistentDataContainer().set(Main.IMPALING_TAG, PersistentDataType.INTEGER, level);
}
public static boolean getLoyalty(Trident trident) {
public static boolean hasLoyalty(Trident trident) {
return trident.getItem().getEnchantments().containsKey(Enchantment.LOYALTY);
}