diff --git a/.classpath b/.classpath
index 0ab4720..cc4498e 100644
--- a/.classpath
+++ b/.classpath
@@ -6,7 +6,7 @@
-
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index ebfb89d..d089a9b 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,11 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
-org.eclipse.jdt.core.compiler.compliance=15
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=15
+org.eclipse.jdt.core.compiler.source=17
diff --git a/en-us.yml b/en-us.yml
index 5dbd15b..811bff5 100644
--- a/en-us.yml
+++ b/en-us.yml
@@ -83,6 +83,7 @@ actions:
kitpvpkill: kill
recover: recovered inv of
money: money
+ gamemode: switched gamemode to
pos: position
activity: activity
hurt: hurt
diff --git a/implement.bat b/implement.bat
new file mode 100644
index 0000000..9eea688
--- /dev/null
+++ b/implement.bat
@@ -0,0 +1,2 @@
+@Echo off
+copy %UserProfile%\eclipse-workspace\AuxProtect\target\AuxProtect-1.1-pre6.jar %UserProfile%\Documents\TestServer\Test1\plugins\AuxProtect.jar
\ No newline at end of file
diff --git a/plugin.yml b/plugin.yml
index 49f216a..280cd43 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,5 +1,5 @@
name: AuxProtect
-version: 1.1-pre5
+version: 1.1-pre7
main: dev.heliosares.auxprotect.AuxProtect
description: A plugin designed to supplement CoreProtect in a few ways.
api-version: 1.13
diff --git a/pom.xml b/pom.xml
index 2e7d1bc..919621c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,16 +2,19 @@
4.0.0
AuxProtect
AuxProtect
- 1.1-pre5
+ 1.1-pre7
AuxProtect
- ${testserver}/plugins
+ ${project.artifactId}-${project.version}
${basedir}
true
- *
+ plugin.yml
+ en-us.yml
+ config.yml
+ bungee.yml
@@ -21,9 +24,30 @@
maven-compiler-plugin
3.8.1
- 15
+ 17
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ 3.1.0
+
+
+ package
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
@@ -113,7 +137,7 @@
auctionhouse
1.0
system
- ${jars}/AuctionHouse-1.18-3.1.jar
+ ${jars}/AuctionHouse-1.18.2-3.2.2.jar
com.github.7sat
@@ -123,7 +147,7 @@
- ${env.USERPROFILE}/eclipse-workspace\jars
+ ${env.USERPROFILE}/eclipse-workspace/jars
${env.USERPROFILE}/Documents/TestServer/Test1/
\ No newline at end of file
diff --git a/scripts/implement.cmd b/scripts/implement.cmd
new file mode 100644
index 0000000..7b2f4ef
--- /dev/null
+++ b/scripts/implement.cmd
@@ -0,0 +1,2 @@
+@Echo off
+copy %UserProfile%\eclipse-workspace\AuxProtect\target\AuxProtect.jar %UserProfile%\Documents\TestServer\Test1\plugins\AuxProtect.jar
\ No newline at end of file
diff --git a/src/dev/heliosares/auxprotect/APPlayer.java b/src/dev/heliosares/auxprotect/APPlayer.java
index 7996c77..ed42832 100644
--- a/src/dev/heliosares/auxprotect/APPlayer.java
+++ b/src/dev/heliosares/auxprotect/APPlayer.java
@@ -12,8 +12,9 @@ public class APPlayer {
public long lastLoggedActivity;
public Location lastLocation;
public long lastCheckedMovement;
- public double moved;
- public double[] activity = new double[20];
+ public double movedAmountThisMinute;
+ public boolean hasMovedThisMinute;
+ public double[] activity = new double[30];
public int activityIndex;
public long lastNotifyInactive;
diff --git a/src/dev/heliosares/auxprotect/AuxProtect.java b/src/dev/heliosares/auxprotect/AuxProtect.java
index 1f66046..fc53e55 100644
--- a/src/dev/heliosares/auxprotect/AuxProtect.java
+++ b/src/dev/heliosares/auxprotect/AuxProtect.java
@@ -207,7 +207,7 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
if (System.currentTimeMillis() - apPlayer.lastCheckedMovement > 1000) {
if (apPlayer.lastLocation != null
&& apPlayer.lastLocation.getWorld().equals(apPlayer.player.getWorld())) {
- apPlayer.moved += Math
+ apPlayer.movedAmountThisMinute += Math
.min(apPlayer.lastLocation.distance(apPlayer.player.getLocation()), 10);
}
apPlayer.lastLocation = apPlayer.player.getLocation();
@@ -221,7 +221,13 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
if (apPlayer.player.getWorld().getName().equals("flat") && config.isPrivate()) {
apPlayer.activity[apPlayer.activityIndex] += 100;
}
- apPlayer.activity[apPlayer.activityIndex] += Math.floor((apPlayer.moved + 7) / 10);
+ apPlayer.addActivity(Math.floor((apPlayer.movedAmountThisMinute + 7) / 10));
+ apPlayer.movedAmountThisMinute = 0;
+
+ if (apPlayer.hasMovedThisMinute) {
+ apPlayer.addActivity(1);
+ apPlayer.hasMovedThisMinute = false;
+ }
add(new DbEntry(AuxProtect.getLabel(apPlayer.player), EntryAction.ACTIVITY, false,
apPlayer.player.getLocation(), "",
@@ -239,7 +245,8 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
inactive++;
}
}
- if (tallied >= 10 && (double) inactive / (double) tallied > 0.8) {
+ if (tallied >= 15 && (double) inactive / (double) tallied > 0.75
+ && !MyPermission.BYPASS_INACTIVE.hasPermission(apPlayer.player)) {
if (System.currentTimeMillis() - apPlayer.lastNotifyInactive > 600000L) {
apPlayer.lastNotifyInactive = System.currentTimeMillis();
String msg = String.format(lang.translate("inactive-alert"),
@@ -260,7 +267,6 @@ public class AuxProtect extends JavaPlugin implements IAuxProtect {
apPlayer.activityIndex = 0;
}
apPlayer.activity[apPlayer.activityIndex] = 0;
- apPlayer.moved = 0;
}
}
}
diff --git a/src/dev/heliosares/auxprotect/command/APCommand.java b/src/dev/heliosares/auxprotect/command/APCommand.java
index a286198..08cdc12 100644
--- a/src/dev/heliosares/auxprotect/command/APCommand.java
+++ b/src/dev/heliosares/auxprotect/command/APCommand.java
@@ -25,6 +25,7 @@ public class APCommand implements CommandExecutor {
private ActivityCommand activityCommand;
private XrayCommand xrayCommand;
private MoneyCommand moneyCommand;
+ private RetentionCommand retentionCommand;
public APCommand(AuxProtect plugin) {
this.plugin = plugin;
@@ -35,6 +36,7 @@ public class APCommand implements CommandExecutor {
activityCommand = new ActivityCommand(plugin);
xrayCommand = new XrayCommand(plugin);
moneyCommand = new MoneyCommand(plugin);
+ retentionCommand = new RetentionCommand(plugin);
}
@Override
@@ -71,6 +73,12 @@ public class APCommand implements CommandExecutor {
return true;
}
return moneyCommand.onCommand(sender, command, label, args);
+ } else if (args[0].equalsIgnoreCase("retention")) {
+ if (!MyPermission.LOOKUP_RETENTION.hasPermission(sender)) {
+ sender.sendMessage(plugin.translate("no-permission"));
+ return true;
+ }
+ return retentionCommand.onCommand(sender, command, label, args);
} else if ((args[0].equalsIgnoreCase("x") || args[0].equalsIgnoreCase("xray"))
&& plugin.config.isPrivate()) {
if (!MyPermission.LOOKUP_XRAY.hasPermission(sender)) {
diff --git a/src/dev/heliosares/auxprotect/command/APCommandTab.java b/src/dev/heliosares/auxprotect/command/APCommandTab.java
index 7c2ef4f..36fd89b 100644
--- a/src/dev/heliosares/auxprotect/command/APCommandTab.java
+++ b/src/dev/heliosares/auxprotect/command/APCommandTab.java
@@ -40,14 +40,17 @@ public class APCommandTab implements TabCompleter {
if (MyPermission.LOOKUP_ACTIVITY.hasPermission(sender)) {
possible.add("activity");
}
+ if (MyPermission.LOOKUP_RETENTION.hasPermission(sender)) {
+ possible.add("retention");
+ }
+ if (MyPermission.LOOKUP_MONEY.hasPermission(sender)) {
+ possible.add("money");
+ }
}
if (MyPermission.ADMIN.hasPermission(sender)) {
possible.add("debug");
possible.add("stats");
}
- if (MyPermission.LOOKUP_MONEY.hasPermission(sender)) {
- possible.add("money");
- }
if (MyPermission.HELP.hasPermission(sender)) {
possible.add("help");
}
diff --git a/src/dev/heliosares/auxprotect/command/LookupCommand.java b/src/dev/heliosares/auxprotect/command/LookupCommand.java
index 4eb4ab7..704ec4f 100644
--- a/src/dev/heliosares/auxprotect/command/LookupCommand.java
+++ b/src/dev/heliosares/auxprotect/command/LookupCommand.java
@@ -17,6 +17,7 @@ import dev.heliosares.auxprotect.utils.MoneySolver;
import dev.heliosares.auxprotect.utils.MyPermission;
import dev.heliosares.auxprotect.utils.MySender;
import dev.heliosares.auxprotect.utils.PlayTimeSolver;
+import dev.heliosares.auxprotect.utils.RetentionSolver;
import dev.heliosares.auxprotect.utils.TimeUtil;
import dev.heliosares.auxprotect.utils.XraySolver;
@@ -127,6 +128,7 @@ public class LookupCommand {
boolean bw = false;
boolean money = false;
boolean activity = false;
+ boolean retention = false;
long startTime = 0;
long endTime = System.currentTimeMillis();
for (int i = 1; i < args.length; i++) {
@@ -160,6 +162,13 @@ public class LookupCommand {
}
money = true;
continue;
+ } else if (args[i].equalsIgnoreCase("#retention")) {
+ if (!MyPermission.LOOKUP_RETENTION.hasPermission(sender)) {
+ sender.sendMessage(plugin.translate("no-permission-flag"));
+ return;
+ }
+ retention = true;
+ continue;
}
String[] split = args[i].split(":");
@@ -430,6 +439,8 @@ public class LookupCommand {
return;
}
+ } else if (retention) {
+ RetentionSolver.showRetention(plugin, sender, rs, startTime, endTime);
} else {
String uuid = sender.getUniqueId().toString();
Results result = new Results(plugin, rs, sender, sender.isBungee() ? "apb" : "ap");
diff --git a/src/dev/heliosares/auxprotect/command/LookupCommandTab.java b/src/dev/heliosares/auxprotect/command/LookupCommandTab.java
index 08feb06..1386733 100644
--- a/src/dev/heliosares/auxprotect/command/LookupCommandTab.java
+++ b/src/dev/heliosares/auxprotect/command/LookupCommandTab.java
@@ -127,6 +127,9 @@ public class LookupCommandTab implements TabCompleter {
if (MyPermission.LOOKUP_ACTIVITY.hasPermission(sender)) {
possible.add("#activity");
}
+ if (MyPermission.LOOKUP_RETENTION.hasPermission(sender)) {
+ possible.add("#retention");
+ }
}
List output = new ArrayList<>();
diff --git a/src/dev/heliosares/auxprotect/command/RetentionCommand.java b/src/dev/heliosares/auxprotect/command/RetentionCommand.java
new file mode 100644
index 0000000..d82984f
--- /dev/null
+++ b/src/dev/heliosares/auxprotect/command/RetentionCommand.java
@@ -0,0 +1,27 @@
+package dev.heliosares.auxprotect.command;
+
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+
+import dev.heliosares.auxprotect.AuxProtect;
+
+public class RetentionCommand implements CommandExecutor {
+
+ private AuxProtect plugin;
+
+ public RetentionCommand(AuxProtect plugin) {
+ this.plugin = plugin;
+ }
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if (args.length != 2) {
+ sender.sendMessage(plugin.translate("lookup-invalid-syntax"));
+ return true;
+ }
+ Bukkit.dispatchCommand(sender, String.format("ap lookup #retention time:%s action:username", args[1]));
+ return true;
+ }
+}
diff --git a/src/dev/heliosares/auxprotect/command/XrayCommand.java b/src/dev/heliosares/auxprotect/command/XrayCommand.java
index c8c9be4..a72ac88 100644
--- a/src/dev/heliosares/auxprotect/command/XrayCommand.java
+++ b/src/dev/heliosares/auxprotect/command/XrayCommand.java
@@ -241,8 +241,8 @@ public class XrayCommand implements CommandExecutor {
new BukkitRunnable() {
@Override
public void run() {
- Bukkit.getServer().dispatchCommand(sender, (String.format("ap tp %d %d %d %s",
- newEnt.x, newEnt.y, newEnt.z, newEnt.world)));
+ Bukkit.getServer().dispatchCommand(sender, (String.format("ap tp %d %d %d %s %d %d",
+ newEnt.x, newEnt.y, newEnt.z, newEnt.world, 45, 0)));
}
}.runTask(plugin);
}
@@ -367,8 +367,8 @@ public class XrayCommand implements CommandExecutor {
if (player != null) {
uuid = player.getUniqueId().toString();
}
- entries.sort((o1, o2) -> o1.getUser().compareTo(o2.getUser()));
entries.sort((o1, o2) -> o1.world.compareTo(o2.world));
+ entries.sort((o1, o2) -> o1.getUser().compareTo(o2.getUser()));
XrayResults result = new XrayResults(plugin, entries, sender);
result.showPage(1, 1);
XrayCommand.this.results.put(uuid, result);
diff --git a/src/dev/heliosares/auxprotect/database/EntryAction.java b/src/dev/heliosares/auxprotect/database/EntryAction.java
index bb7e8cc..a57769b 100644
--- a/src/dev/heliosares/auxprotect/database/EntryAction.java
+++ b/src/dev/heliosares/auxprotect/database/EntryAction.java
@@ -47,6 +47,7 @@ public class EntryAction {
// SKIPPED 135
public static final EntryAction RECOVER = new EntryAction("recover", 136);
public static final EntryAction MONEY = new EntryAction("money", 137);
+ public static final EntryAction GAMEMODE = new EntryAction("gamemode", 138);
// END DEFAULT (255)
// START SPAM(256)
@@ -58,6 +59,7 @@ public class EntryAction {
public static final EntryAction LAND = new EntryAction("land", 262);
public static final EntryAction ELYTRA = new EntryAction("elytra", 263, 264);
public static final EntryAction ACTIVITY = new EntryAction("activity", 265);
+ public static final EntryAction TOTEM = new EntryAction("totem", 266);
// END SPAM(511)
// START IGNOREABANDONED(512)
diff --git a/src/dev/heliosares/auxprotect/database/Results.java b/src/dev/heliosares/auxprotect/database/Results.java
index 1c731cc..06ad2f8 100644
--- a/src/dev/heliosares/auxprotect/database/Results.java
+++ b/src/dev/heliosares/auxprotect/database/Results.java
@@ -81,8 +81,19 @@ public class Results {
+ "\n§7Click to copy epoch time.")))
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, en.getTime() + "e"));
- message.append(String.format(" §f- §9%s §f%s §9%s§f", en.getUser(),
- en.getAction().getText(plugin, en.getState()), en.getTarget())).event((HoverEvent) null);
+ // message.append(String.format(" §f- §9%s §f%s §9%s§f", en.getUser(),
+ // en.getAction().getText(plugin, en.getState()),
+ // en.getTarget())).event((HoverEvent) null);
+ message.append(" §f- ").event((HoverEvent) null);
+ HoverEvent clickToCopy = new HoverEvent(HoverEvent.Action.SHOW_TEXT,
+ new Text("Click to copy to clipboard"));
+ message.append("§9" + en.getUser()).event(clickToCopy)
+ .event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, en.getUser()));
+ message.append(" §f" + en.getAction().getText(plugin, en.getState())).event((HoverEvent) null)
+ .event((ClickEvent) null);
+ message.append(" §9" + en.getTarget()).event(clickToCopy)
+ .event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, en.getTarget()));
+
String data = en.getData();
if (data != null && data.contains(InvSerialization.itemSeparator)) {
data = data.split(InvSerialization.itemSeparator)[0];
@@ -93,30 +104,33 @@ public class Results {
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§fClick to view!")));
}
}
- if (en.getAction().equals( EntryAction.INVENTORY)) {
+ if (en.getAction().equals(EntryAction.INVENTORY)) {
if (MyPermission.INV.hasPermission(player)) {
message.append(" §a[View]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
String.format(commandPrefix + " inv %d", i)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§fClick to view!")));
}
- } else if (en.getAction() .equals( EntryAction.KILL)) {
+ } else if (en.getAction().equals(EntryAction.KILL)) {
if (MyPermission.INV.hasPermission(player) && !en.getTarget().startsWith("#")) {
message.append(" §a[View Inv]").event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
String.format(commandPrefix + " l u:%s a:inventory target:death before:%de after:%de",
en.getTarget(), en.getTime() + 50L, en.getTime() - 50L)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§fClick to view!")));
}
- message.append(" §7(" + data + ")");
+ message.append(" §7(" + data + ")").event(clickToCopy)
+ .event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, en.getData()));
} else if (data != null && data.length() > 0) {
- message.append(" §7(" + data + ")");
+ message.append(" §7(" + data + ")").event(clickToCopy)
+ .event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, en.getData()));
}
if (en.world != null && !en.world.equals("$null")) {
String tpCommand = String.format(commandPrefix + " tp %d %d %d %s", en.x, en.y, en.z, en.world);
if (en.getAction().getTable().hasLook()) {
tpCommand += String.format(" %d %d", en.pitch, en.yaw);
}
- message.append(String.format("\n §7§l^ §7(x%d/y%d/z%d/%s)", en.x, en.y, en.z, en.world))
+ message.append("\n §7§l^ ").event((HoverEvent) null).event((ClickEvent) null);
+ message.append(String.format("§7(x%d/y%d/z%d/%s)", en.x, en.y, en.z, en.world))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, tpCommand))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§7" + tpCommand)));
if (en.getAction().getTable().hasLook()) {
diff --git a/src/dev/heliosares/auxprotect/database/SQLManager.java b/src/dev/heliosares/auxprotect/database/SQLManager.java
index f8a81a6..b60eaba 100644
--- a/src/dev/heliosares/auxprotect/database/SQLManager.java
+++ b/src/dev/heliosares/auxprotect/database/SQLManager.java
@@ -655,6 +655,28 @@ public class SQLManager {
return rowList;
}
+ public HashMap getAllUids() throws SQLException {
+ HashMap out = new HashMap<>();
+
+ synchronized (connection) {
+
+ String stmt = "SELECT * FROM " + Table.AUXPROTECT_UIDS.toString() + ";";
+ plugin.debug(stmt, 3);
+ try (PreparedStatement pstmt = connection.prepareStatement(stmt)) {
+ pstmt.setFetchSize(500);
+ try (ResultSet results = pstmt.executeQuery()) {
+ while (results.next()) {
+ int uid = results.getInt("uid");
+ String uuid = results.getString("uuid");
+ out.put(uid, uuid);
+ }
+ }
+ }
+ }
+
+ return out;
+ }
+
private void putRaw(Table table, ArrayList