Merge 212ca9ddec
into 41ad3c66b4
This commit is contained in:
commit
2abb29525c
20
pom.xml
20
pom.xml
|
@ -52,6 +52,10 @@
|
|||
<pattern>com.jeff_media.jefflib</pattern>
|
||||
<shadedPattern>de.jeff_media.bettertridents.jefflib</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.github.Anon8281.universalScheduler</pattern>
|
||||
<shadedPattern>de.jeff_media.bettertridents.universalScheduler</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
@ -107,7 +111,11 @@
|
|||
</repository>
|
||||
<repository>
|
||||
<id>jeff-media-gbr</id>
|
||||
<url>https://repo.jeff-media.de/maven2</url>
|
||||
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -116,13 +124,13 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeff_media</groupId>
|
||||
<artifactId>JeffLib</artifactId>
|
||||
<version>12.4.2</version>
|
||||
<version>12.6.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -137,6 +145,12 @@
|
|||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.Anon8281</groupId>
|
||||
<artifactId>UniversalScheduler</artifactId>
|
||||
<version>0.1.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package de.jeff_media.bettertridents;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.UniversalScheduler;
|
||||
import com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler;
|
||||
import de.jeff_media.bettertridents.commands.ReloadCommand;
|
||||
import de.jeff_media.bettertridents.config.Config;
|
||||
import de.jeff_media.bettertridents.config.ConfigUpdater;
|
||||
|
@ -19,6 +21,7 @@ import java.util.UUID;
|
|||
public class Main extends JavaPlugin {
|
||||
|
||||
private static Main instance;
|
||||
private static TaskScheduler scheduler;
|
||||
//private final ArrayList<UUID> tridents = new ArrayList<>();
|
||||
public static NamespacedKey LOYALTY_TAG;
|
||||
public static NamespacedKey IMPALING_TAG;
|
||||
|
@ -27,15 +30,17 @@ public class Main extends JavaPlugin {
|
|||
public static Main getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private boolean debug = false;
|
||||
|
||||
public void debug(String text) {
|
||||
if(debug) getLogger().warning("[DEBUG] " + text);
|
||||
if (debug) getLogger().warning("[DEBUG] " + text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
scheduler = UniversalScheduler.getScheduler(this);
|
||||
LOYALTY_TAG = new NamespacedKey(this, "loyalty");
|
||||
IMPALING_TAG = new NamespacedKey(this, "impaling");
|
||||
OFFHAND_TAG = new NamespacedKey(this, "offhand");
|
||||
|
@ -50,29 +55,37 @@ public class Main extends JavaPlugin {
|
|||
}
|
||||
|
||||
public void reload() {
|
||||
if(!new File(getDataFolder(), "config.yml").exists()) {
|
||||
if (!new File(getDataFolder(), "config.yml").exists()) {
|
||||
saveDefaultConfig();
|
||||
}
|
||||
reloadConfig();
|
||||
new Config();
|
||||
ConfigUpdater.updateConfig();
|
||||
UpdateChecker.init(this, "https://api.jeff-media.com/notridentvoid/latest-version.txt")
|
||||
.setDonationLink("https://paypal.me/mfnalex")
|
||||
.setDownloadLink(92656)
|
||||
.setChangelogLink(92656)
|
||||
.setUserAgent(UserAgentBuilder.getDefaultUserAgent());
|
||||
if(getConfig().getString(Config.CHECK_FOR_UPDATES).equalsIgnoreCase("true")) {
|
||||
UpdateChecker.getInstance().checkEveryXHours(getConfig().getDouble(Config.UPDATE_CHECK_INTERVAL))
|
||||
.checkNow();
|
||||
} else if(getConfig().getString(Config.CHECK_FOR_UPDATES).equalsIgnoreCase("on-startup")) {
|
||||
UpdateChecker.getInstance().checkNow();
|
||||
try {
|
||||
UpdateChecker.init(this, "https://api.jeff-media.com/notridentvoid/latest-version.txt")
|
||||
.setDonationLink("https://paypal.me/mfnalex")
|
||||
.setDownloadLink(92656)
|
||||
.setChangelogLink(92656)
|
||||
.setUserAgent(UserAgentBuilder.getDefaultUserAgent());
|
||||
if (getConfig().getString(Config.CHECK_FOR_UPDATES).equalsIgnoreCase("true")) {
|
||||
UpdateChecker.getInstance().checkEveryXHours(getConfig().getDouble(Config.UPDATE_CHECK_INTERVAL))
|
||||
.checkNow();
|
||||
} else if (getConfig().getString(Config.CHECK_FOR_UPDATES).equalsIgnoreCase("on-startup")) {
|
||||
UpdateChecker.getInstance().checkNow();
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException e) {
|
||||
getLogger().warning("Update checker doesn't support Folia");
|
||||
}
|
||||
debug = getConfig().getBoolean(Config.DEBUG);
|
||||
if(debug) {
|
||||
if (debug) {
|
||||
getLogger().warning("Debug mode enabled - this may affect performance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static TaskScheduler getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
// public void setLoyal(Trident trident) {
|
||||
// tridents.add(trident.getUniqueId());
|
||||
// }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package de.jeff_media.bettertridents.tasks;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.UniversalRunnable;
|
||||
import de.jeff_media.bettertridents.Main;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class MoveToOffhand extends BukkitRunnable {
|
||||
public class MoveToOffhand extends UniversalRunnable {
|
||||
private final Player player;
|
||||
private final ItemStack tridentItem;
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package de.jeff_media.bettertridents.tasks;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.UniversalRunnable;
|
||||
import de.jeff_media.bettertridents.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Trident;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class RemoveBarrier extends BukkitRunnable {
|
||||
public class RemoveBarrier extends UniversalRunnable {
|
||||
|
||||
private static final int MAX_TICKS = 40;
|
||||
private final Block block;
|
||||
|
@ -23,7 +22,7 @@ public class RemoveBarrier extends BukkitRunnable {
|
|||
public void run() {
|
||||
ticks++;
|
||||
if(ticks >= MAX_TICKS || (trident.getVelocity().length() > 0 && trident.getLocation().distanceSquared(block.getLocation())>2)) {
|
||||
Bukkit.getScheduler().runTaskLater(Main.getInstance(), () ->{
|
||||
Main.getScheduler().runTaskLater(() ->{
|
||||
if (block.getType() == Material.BARRIER) {
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package de.jeff_media.bettertridents.tasks;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.UniversalRunnable;
|
||||
import com.jeff_media.jefflib.WorldUtils;
|
||||
import de.jeff_media.bettertridents.Main;
|
||||
import com.jeff_media.jefflib.ReflUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Trident;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class WatchTrident extends BukkitRunnable {
|
||||
public class WatchTrident extends UniversalRunnable {
|
||||
|
||||
private static final int MAX_TICKS = 1200;
|
||||
private static Field damageDealtField;
|
||||
|
|
|
@ -7,6 +7,7 @@ authors: [mfnalex, JEFF Media GbR]
|
|||
website: "https://www.jeff-media.com"
|
||||
database: false
|
||||
load: STARTUP
|
||||
folia-supported: true
|
||||
commands:
|
||||
bettertridents:
|
||||
description: Reloads the config file
|
||||
|
|
Loading…
Reference in New Issue