This commit is contained in:
Internal-Exception
2022-02-14 10:33:13 -05:00
parent adf6f5634a
commit 6041fa766f
5 changed files with 40 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
name: AuxProtect
version: 1.0.6
version: 1.0.7
main: dev.heliosares.auxprotect.AuxProtect
description: A plugin designed to suplement CoreProtect in a few ways.
api-version: 1.13

View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>AuxProtect</groupId>
<artifactId>AuxProtect</artifactId>
<version>1.0.6</version>
<version>1.0.7</version>
<name>AuxProtect</name>
<build>
<directory>${myPath}/plugins</directory>

View File

@@ -69,6 +69,12 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
long lastloaded;
private int SERVER_VERSION;
public int getCompatabilityVersion() {
return SERVER_VERSION;
}
@Override
public void onEnable() {
instance = this;
@@ -77,6 +83,11 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
this.reloadConfig();
this.getConfig().options().copyDefaults(true);
debug = getConfig().getInt("debug", 0);
config = new APConfig(this.getConfig());
config.load();
YMLManager langManager = new YMLManager("en-us", this);
langManager.load(true);
lang = new Language(langManager.getData());
@@ -87,10 +98,14 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
data.getData().set("lastloaded", System.currentTimeMillis());
data.save();
config = new APConfig(this.getConfig());
config.load();
debug = getConfig().getInt("debug", 0);
try {
SERVER_VERSION = Integer.parseInt(Bukkit.getBukkitVersion().split("\\.")[1]);
} catch (Exception e) {
warning("Failed to parse version string: \"" + Bukkit.getBukkitVersion() + "\". Defaulting to 1.16");
SERVER_VERSION = 16;
e.printStackTrace();
}
debug("Compatability version: " + SERVER_VERSION, 1);
File sqliteFile = new File(getDataFolder(), "database/auxprotect.db");
if (!sqliteFile.getParentFile().exists()) {
@@ -153,9 +168,7 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
if (System.currentTimeMillis() - lastPos > config.posInterval) {
lastPos = System.currentTimeMillis();
for (Player player : Bukkit.getOnlinePlayers()) {
dbRunnable.add(new DbEntry("$" + player.getUniqueId().toString(), EntryAction.POS, false,
player.getLocation(), "", "Y:" + Math.round(player.getLocation().getYaw()) + " P:"
+ Math.round(player.getLocation().getPitch())));
PlayerListener.logPos(AuxProtect.this, player, player.getLocation(), "");
}
}
}

View File

@@ -260,7 +260,9 @@ public class XrayCommand implements CommandExecutor {
actions.add(0);
List<Object> blocks = new ArrayList<>();
blocks.add(Material.DIAMOND_ORE);
blocks.add(Material.DEEPSLATE_DIAMOND_ORE);
if (plugin.getCompatabilityVersion() >= 17) {
blocks.add(Material.DEEPSLATE_DIAMOND_ORE);
}
blocks.add(Material.ANCIENT_DEBRIS);
/*
@@ -316,8 +318,8 @@ public class XrayCommand implements CommandExecutor {
false, res.worldName(), res.getX(), res.getY(), res.getZ(),
res.getType().toString().toLowerCase(), "");
if (res.getType() == Material.DIAMOND_ORE
|| res.getType() == Material.DEEPSLATE_DIAMOND_ORE) {
if (res.getType() == Material.DIAMOND_ORE || (plugin.getCompatabilityVersion() >= 17
&& res.getType() == Material.DEEPSLATE_DIAMOND_ORE)) {
if (res.getY() > 18) {
continue;
}

View File

@@ -55,14 +55,18 @@ public class PlayerListener implements Listener {
public PlayerListener(AuxProtect plugin) {
this.plugin = plugin;
buckets = new ArrayList<>();
buckets.add(Material.AXOLOTL_BUCKET);
if (plugin.getCompatabilityVersion() >= 17) {
buckets.add(Material.AXOLOTL_BUCKET);
}
buckets.add(Material.COD_BUCKET);
buckets.add(Material.SALMON_BUCKET);
buckets.add(Material.TROPICAL_FISH_BUCKET);
buckets.add(Material.PUFFERFISH_BUCKET);
mobs = new ArrayList<>();
mobs.add(EntityType.PUFFERFISH);
mobs.add(EntityType.AXOLOTL);
if (plugin.getCompatabilityVersion() >= 17) {
mobs.add(EntityType.AXOLOTL);
}
mobs.add(EntityType.TROPICAL_FISH);
mobs.add(EntityType.COD);
mobs.add(EntityType.SALMON);
@@ -216,7 +220,8 @@ public class PlayerListener implements Listener {
}
@EventHandler
public void onWorldChange(PlayerTeleportEvent e) {
public void onPlayerTeleport(PlayerTeleportEvent e) {
logPos(plugin, e.getPlayer(), e.getTo(), "tele");
if (!plugin.config.inventoryOnWorldChange || e.getFrom().getWorld().equals(e.getTo().getWorld())) {
return;
}
@@ -374,4 +379,9 @@ public class PlayerListener implements Listener {
}
return false;
}
public static void logPos(AuxProtect auxProtect, Player player, Location location, String string) {
auxProtect.dbRunnable.add(new DbEntry("$" + player.getUniqueId().toString(), EntryAction.POS, false, location,
string, "Y:" + Math.round(location.getYaw()) + " P:" + Math.round(location.getPitch())));
}
}