Changed additional timestamp values to long types

This commit is contained in:
Intelli 2021-12-16 18:08:56 -07:00
parent 08aeb5d5aa
commit d7ee5257dd
17 changed files with 44 additions and 46 deletions

View file

@ -11,14 +11,13 @@ import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class ApplyCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
int time = (Integer) list.get(0);
long time = (Long) list.get(0);
args = (String[]) list.get(1);
Location location = (Location) list.get(2);
boolean valid = false;

View file

@ -11,14 +11,13 @@ import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class CancelCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
int time = (Integer) list.get(0);
long time = (Long) list.get(0);
args = (String[]) list.get(1);
Location location = (Location) list.get(2);
boolean valid = false;

View file

@ -691,9 +691,9 @@ public class CommandHandler implements CommandExecutor {
return restricted;
}
protected static int parseTime(String[] inputArguments) {
protected static long parseTime(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
int time = 0;
long time = 0;
int count = 0;
int next = 0;
double w = 0;
@ -754,7 +754,7 @@ public class CommandHandler implements CommandExecutor {
}
}
double rs = ((w * 7 * 24 * 60 * 60) + (d * 24 * 60 * 60) + (h * 60 * 60) + (m * 60) + s);
time = (int) rs;
time = (long) rs;
next = 0;
}
else {
@ -763,6 +763,7 @@ public class CommandHandler implements CommandExecutor {
}
count++;
}
return time;
}

View file

@ -7,7 +7,6 @@ import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class InspectCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {

View file

@ -51,7 +51,7 @@ public class LookupCommand {
List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction);
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
String ts = CommandHandler.parseTimeString(args);
int rbseconds = CommandHandler.parseTime(args);
long rbseconds = CommandHandler.parseTime(args);
int argWid = CommandHandler.parseWorld(args, true, true);
int parseRows = CommandHandler.parseRows(args);
boolean count = CommandHandler.parseCount(args);
@ -554,7 +554,7 @@ public class LookupCommand {
c++;
}
int cs = -1;
long cs = -1;
int x = 0;
int y = 0;
int z = 0;
@ -567,7 +567,7 @@ public class LookupCommand {
y = Integer.parseInt(data[1]);
z = Integer.parseInt(data[2]);
wid = Integer.parseInt(data[3]);
cs = Integer.parseInt(data[4]);
cs = Long.parseLong(data[4]);
// arg_radius = Integer.parseInt(data[5]);
argNoisy = Integer.parseInt(data[5]);
argExcluded = Integer.parseInt(data[6]);
@ -640,7 +640,7 @@ public class LookupCommand {
}
final List<String> rollbackusers2 = rollbackusers;
int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
long unixtimestamp = (System.currentTimeMillis() / 1000L);
if (cs == -1) {
if (rbseconds <= 0) {
cs = 0;
@ -649,7 +649,7 @@ public class LookupCommand {
cs = unixtimestamp - rbseconds;
}
}
final int stime = cs;
final long stime = cs;
final Integer[] radius = argRadius;
try {

View file

@ -1,7 +1,10 @@
package net.coreprotect.command;
import java.io.File;
import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.List;
@ -28,7 +31,7 @@ public class PurgeCommand extends Consumer {
int resultc = args.length;
Location location = CommandHandler.parseLocation(player, args);
final Integer[] argRadius = CommandHandler.parseRadius(args, player, location);
final int seconds = CommandHandler.parseTime(args);
final long seconds = CommandHandler.parseTime(args);
final int argWid = CommandHandler.parseWorld(args, false, false);
final List<Integer> argAction = CommandHandler.parseAction(args);
final List<Integer> supportedActions = Arrays.asList();
@ -92,8 +95,8 @@ public class PurgeCommand extends Consumer {
@Override
public void run() {
try (Connection connection = Database.getConnection(false, 500)) {
int timestamp = (int) (System.currentTimeMillis() / 1000L);
int ptime = timestamp - seconds;
long timestamp = (System.currentTimeMillis() / 1000L);
long ptime = timestamp - seconds;
long removed = 0;
for (int i = 0; i <= 5; i++) {

View file

@ -31,7 +31,7 @@ import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class RollbackRestoreCommand {
protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args, Location argLocation, int forceSeconds) {
protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args, Location argLocation, long forceSeconds) {
Location lo = (argLocation != null ? argLocation : CommandHandler.parseLocation(player, args));
List<String> argUuids = new ArrayList<>();
List<String> argUsers = CommandHandler.parseUsers(args);
@ -42,7 +42,7 @@ public class RollbackRestoreCommand {
List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction);
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
String ts = CommandHandler.parseTimeString(args);
int rbSeconds = CommandHandler.parseTime(args);
long rbSeconds = CommandHandler.parseTime(args);
int argWid = CommandHandler.parseWorld(args, true, true);
boolean count = CommandHandler.parseCount(args);
boolean worldedit = CommandHandler.parseWorldEdit(args);
@ -284,12 +284,12 @@ public class RollbackRestoreCommand {
final List<String> rollbackusers2 = rollbackusers;
if (rbSeconds > 0) {
int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
int seconds = unixtimestamp - rbSeconds;
long unixtimestamp = (System.currentTimeMillis() / 1000L);
long seconds = unixtimestamp - rbSeconds;
if (forceSeconds > 0) {
seconds = forceSeconds;
}
final int stime = seconds;
final long stime = seconds;
final Integer[] radius = argRadius;
try {
final CommandSender player2 = player;

View file

@ -11,14 +11,13 @@ import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class UndoCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
int time = (Integer) list.get(0);
long time = (Long) list.get(0);
args = (String[]) list.get(1);
Location location = (Location) list.get(2);
for (String arg : args) {