mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-30 21:17:49 +01:00
removed NumberFormatException, IllegalArgumentException,UnsupportedOperationException, NullPointerException throws from method signatures
This commit is contained in:
parent
bf21aae791
commit
0c210f4877
@ -70,7 +70,7 @@ public class RegisterCommand extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void consoleRegister(String[] args, ISender sender, String notEnoughArgsMsg) throws NumberFormatException, PassEncryptUtil.CannotPerformOperationException {
|
private void consoleRegister(String[] args, ISender sender, String notEnoughArgsMsg) throws PassEncryptUtil.CannotPerformOperationException {
|
||||||
if (Check.isTrue(args.length >= 3, notEnoughArgsMsg, sender)) {
|
if (Check.isTrue(args.length >= 3, notEnoughArgsMsg, sender)) {
|
||||||
int permLevel;
|
int permLevel;
|
||||||
permLevel = Integer.parseInt(args[2]);
|
permLevel = Integer.parseInt(args[2]);
|
||||||
|
@ -200,10 +200,11 @@ public abstract class PluginData {
|
|||||||
* @param uuid UUID of the player the value belongs to.
|
* @param uuid UUID of the player the value belongs to.
|
||||||
* @return Long, Integer, Double, Boolean or String, return -1 if the player
|
* @return Long, Integer, Double, Boolean or String, return -1 if the player
|
||||||
* has no value.
|
* has no value.
|
||||||
|
* @throws UnsupportedOperationException if implementing class has not overridden the method.
|
||||||
*/
|
*/
|
||||||
public abstract Serializable getValue(UUID uuid);
|
public abstract Serializable getValue(UUID uuid);
|
||||||
|
|
||||||
public Map<UUID, Serializable> getValues(Collection<UUID> uuids) throws UnsupportedOperationException {
|
public Map<UUID, Serializable> getValues(Collection<UUID> uuids) {
|
||||||
throw new UnsupportedOperationException("Not overridden.");
|
throw new UnsupportedOperationException("Not overridden.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,13 @@ public class GamemodePart extends RawData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTo(String gm, long amount) throws IllegalArgumentException {
|
/**
|
||||||
|
* Adds time to a gamemode.
|
||||||
|
* @param gm Name of Gamemode
|
||||||
|
* @param amount milliseconds to add
|
||||||
|
* @throws IllegalArgumentException if gm is null
|
||||||
|
*/
|
||||||
|
public void addTo(String gm, long amount) {
|
||||||
Verify.nullCheck(gm);
|
Verify.nullCheck(gm);
|
||||||
switch (gm) {
|
switch (gm) {
|
||||||
case "SURVIVAL":
|
case "SURVIVAL":
|
||||||
|
@ -48,7 +48,14 @@ public class KillPart extends RawData {
|
|||||||
addValue("avgplayerkills", MathUtils.averageLong(playerKillAmount, playerCount));
|
addValue("avgplayerkills", MathUtils.averageLong(playerKillAmount, playerCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addKills(UUID uuid, List<KillData> kills) throws IllegalArgumentException {
|
/**
|
||||||
|
* Adds kills to the dataset.
|
||||||
|
*
|
||||||
|
* @param uuid Player whose kills are being added
|
||||||
|
* @param kills all kills of a player
|
||||||
|
* @throws IllegalArgumentException if kills is null
|
||||||
|
*/
|
||||||
|
public void addKills(UUID uuid, List<KillData> kills) {
|
||||||
Verify.nullCheck(kills);
|
Verify.nullCheck(kills);
|
||||||
playerKills.put(uuid, kills);
|
playerKills.put(uuid, kills);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class GMTimes extends TimeKeeper {
|
|||||||
* @param times 1-4 time parameters.
|
* @param times 1-4 time parameters.
|
||||||
* @throws IllegalArgumentException If any parameter is null.
|
* @throws IllegalArgumentException If any parameter is null.
|
||||||
*/
|
*/
|
||||||
public void setAllGMTimes(long... times) throws IllegalArgumentException {
|
public void setAllGMTimes(long... times) {
|
||||||
Verify.nullCheck(times);
|
Verify.nullCheck(times);
|
||||||
String[] gms = GMTimesTable.getGMKeyArray();
|
String[] gms = GMTimesTable.getGMKeyArray();
|
||||||
int size = times.length;
|
int size = times.length;
|
||||||
|
@ -44,7 +44,13 @@ public abstract class TimeKeeper {
|
|||||||
this(new HashMap<>());
|
this(new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(String state, long time) throws IllegalArgumentException {
|
/**
|
||||||
|
* Sets a specific time for a state.
|
||||||
|
* @param state State to set
|
||||||
|
* @param time Time in ms the state has been active for
|
||||||
|
* @throws IllegalArgumentException If given state is null
|
||||||
|
*/
|
||||||
|
public void setTime(String state, long time) {
|
||||||
times.put(Verify.nullCheck(state), time);
|
times.put(Verify.nullCheck(state), time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ public abstract class Database {
|
|||||||
* @throws SQLException If a database error occurs.
|
* @throws SQLException If a database error occurs.
|
||||||
* @throws NullPointerException If the database has not initialized tables.
|
* @throws NullPointerException If the database has not initialized tables.
|
||||||
*/
|
*/
|
||||||
public void saveCommandUse(Map<String, Integer> data) throws SQLException, NullPointerException {
|
public void saveCommandUse(Map<String, Integer> data) throws SQLException {
|
||||||
commandUseTable.saveCommandUse(data);
|
commandUseTable.saveCommandUse(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package main.java.com.djrapitops.plan.database.tables;
|
package main.java.com.djrapitops.plan.database.tables;
|
||||||
|
|
||||||
|
import com.djrapitops.plugin.utilities.Verify;
|
||||||
import main.java.com.djrapitops.plan.Log;
|
import main.java.com.djrapitops.plan.Log;
|
||||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||||
import main.java.com.djrapitops.plan.utilities.Benchmark;
|
import main.java.com.djrapitops.plan.utilities.Benchmark;
|
||||||
@ -77,10 +78,9 @@ public class CommandUseTable extends Table {
|
|||||||
/**
|
/**
|
||||||
* @param data
|
* @param data
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
* @throws NullPointerException
|
|
||||||
*/
|
*/
|
||||||
public void saveCommandUse(Map<String, Integer> data) throws SQLException, NullPointerException {
|
public void saveCommandUse(Map<String, Integer> data) throws SQLException {
|
||||||
if (data.isEmpty()) {
|
if (Verify.isEmpty(data)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class FormatUtils {
|
|||||||
* @return parsed double - for example 1,11
|
* @return parsed double - for example 1,11
|
||||||
* @throws NumberFormatException When wrong format
|
* @throws NumberFormatException When wrong format
|
||||||
*/
|
*/
|
||||||
public static int parseVersionNumber(String versionString) throws NumberFormatException {
|
public static int parseVersionNumber(String versionString) {
|
||||||
return FormattingUtils.parseVersionNumber(versionString);
|
return FormattingUtils.parseVersionNumber(versionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public class PassEncryptUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] fromBase64(String hex) throws IllegalArgumentException {
|
private static byte[] fromBase64(String hex) {
|
||||||
return DatatypeConverter.parseBase64Binary(hex);
|
return DatatypeConverter.parseBase64Binary(hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user