Add codestyle and fix formatting

This commit is contained in:
Telesphoreo 2021-10-01 00:21:50 -05:00
parent a1f1e4ccc0
commit 2e6b990e33
28 changed files with 80 additions and 73 deletions

View File

@ -0,0 +1,46 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="LAMBDA_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -36,12 +36,6 @@ repositories {
maven {
url = uri('https://maven.elmakers.com/repository/')
content {
includeGroup('org.bukkit')
includeGroup('net.goldtreeservers')
includeGroup('de.bananaco')
includeGroup('net.ess3')
}
}
maven {

View File

@ -1,5 +1,7 @@
package me.totalfreedom.totalfreedommod;
import java.util.HashMap;
import java.util.Map;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FSync;
@ -13,9 +15,6 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import java.util.HashMap;
import java.util.Map;
public class AntiSpam extends FreedomService
{
@ -23,7 +22,7 @@ public class AntiSpam extends FreedomService
public static final int TICKS_PER_CYCLE = 2 * 10;
//
public BukkitTask cycleTask = null;
private Map<Player, Integer> muteCounts = new HashMap<>();
private final Map<Player, Integer> muteCounts = new HashMap<>();
@Override
public void onStart()

View File

@ -52,7 +52,7 @@ public class AutoEject extends FreedomService
method = EjectMethod.STRIKE_THREE;
}
FLog.info("AutoEject -> name: " + player.getName() + " - player ip: " + ip + " - method: " + method.toString());
FLog.info("AutoEject -> name: " + player.getName() + " - player ip: " + ip + " - method: " + method);
player.setOp(false);
player.setGameMode(GameMode.SURVIVAL);

View File

@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod;
import java.io.File;
import me.totalfreedom.totalfreedommod.banning.IndefiniteBanList;
import me.totalfreedom.totalfreedommod.config.YamlConfig;
import me.totalfreedom.totalfreedommod.permissions.PermissionConfig;
@ -8,8 +9,6 @@ import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.util.FileUtil;
import java.io.File;
public class BackupManager extends FreedomService
{

View File

@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.Bukkit;

View File

@ -5,6 +5,7 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
@ -158,14 +159,7 @@ public class LogViewer extends FreedomService
List<String> pairs = new ArrayList<>();
for (Map.Entry<String, String> pair : queryStringMap.entrySet())
{
try
{
pairs.add(URLEncoder.encode(pair.getKey(), "UTF-8") + "=" + URLEncoder.encode(pair.getValue(), "UTF-8"));
}
catch (UnsupportedEncodingException ex)
{
FLog.severe(ex);
}
pairs.add(URLEncoder.encode(pair.getKey(), StandardCharsets.UTF_8) + "=" + URLEncoder.encode(pair.getValue(), StandardCharsets.UTF_8));
}
return new URL(requestPath + "?" + StringUtils.join(pairs, "&"));

View File

@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod;
import com.google.common.collect.Multimap;
import io.papermc.lib.PaperLib;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;

View File

@ -1,7 +1,11 @@
package me.totalfreedom.totalfreedommod.bridge;
import java.io.File;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Collections;

View File

@ -22,7 +22,7 @@ public class Command_debugstick extends FreedomCommand
ItemStack itemStack = new ItemStack(Material.DEBUG_STICK);
ItemMeta itemMeta = itemStack.getItemMeta();
assert itemMeta != null;
itemMeta.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD.toString() + "Stick of Happiness");
itemMeta.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD + "Stick of Happiness");
List<String> lore = Arrays.asList(
ChatColor.RED + "This is the most powerful stick in the game.",
ChatColor.DARK_BLUE + "You can left click to select what you want to change.",

View File

@ -1,7 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.rank.Rank;
@ -12,9 +13,6 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-s | -i | -f | -v]", aliases = "who,lsit")
public class Command_list extends FreedomCommand

View File

@ -145,7 +145,7 @@ public class Command_nickclean extends FreedomCommand
if (nickChanged)
{
msg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNick.toString() + ChatColor.RESET + "\".");
msg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNick + ChatColor.RESET + "\".");
}
plugin.esb.setNickname(playerName, newNick.toString());
}

View File

@ -66,7 +66,7 @@ public class Command_nicknyan extends FreedomCommand
plugin.esb.setNickname(sender.getName(), newNick.toString());
msg("Your nickname is now: " + newNick.toString());
msg("Your nickname is now: " + newNick);
return true;
}
}

View File

@ -1,5 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
@ -13,9 +15,6 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Get the seed of the world you are currently in.", usage = "/seed [world]")
public class Command_seed extends FreedomCommand

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.Location;
import org.bukkit.Material;

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;

View File

@ -1,10 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
import com.earth2me.essentials.User;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import com.earth2me.essentials.User;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.punishments.Punishment;

View File

@ -108,7 +108,7 @@ public class Command_tossmob extends FreedomCommand
playerData.enableMobThrower(type, speed);
msg("MobThrower is enabled. Mob: " + type + " - Speed: " + speed + ".", ChatColor.GREEN);
msg("Right click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN);
msg("Right click while holding a " + Material.BONE + " to throw mobs!", ChatColor.GREEN);
msg("Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN);
Objects.requireNonNull(playerSender.getEquipment()).setItemInMainHand(new ItemStack(Material.BONE, 1));

View File

@ -19,12 +19,7 @@ public class Command_undisguiseall extends FreedomCommand
return true;
}
boolean admins = false;
if (args.length > 0 && args[0].equalsIgnoreCase("-a"))
{
admins = true;
}
boolean admins = args.length > 0 && args[0].equalsIgnoreCase("-a");
FUtil.adminAction(sender.getName(), "Undisguising all " + (admins ? "players" : "non-admins"), true);

View File

@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang.StringUtils;

View File

@ -332,7 +332,7 @@ public class Discord extends FreedomService
}
catch (IOException e)
{
FLog.severe("Failed to generate backup codes file: " + e.toString());
FLog.severe("Failed to generate backup codes file: " + e);
return null;
}
return new File(fileUrl);

View File

@ -338,13 +338,7 @@ public abstract class NanoHTTPD
protected String decodePercent(String str)
{
String decoded = null;
try
{
decoded = URLDecoder.decode(str, "UTF8");
}
catch (UnsupportedEncodingException ignored)
{
}
decoded = URLDecoder.decode(str, StandardCharsets.UTF_8);
return decoded;
}

View File

@ -5,6 +5,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@ -84,13 +85,7 @@ public class Module_file extends HTTPDModule
}
else
{
try
{
newUri.append(URLEncoder.encode(tok, "UTF-8"));
}
catch (UnsupportedEncodingException ignored)
{
}
newUri.append(URLEncoder.encode(tok, StandardCharsets.UTF_8));
}
}
return newUri.toString();

View File

@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod.httpd.module;
import java.util.Collection;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -10,8 +11,6 @@ import org.bukkit.entity.Player;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import java.util.Collection;
public class Module_list extends HTTPDModule
{

View File

@ -9,9 +9,6 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.rank.Title;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;

View File

@ -1,5 +1,7 @@
package me.totalfreedom.totalfreedommod.player;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.caging.CageData;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -14,9 +16,6 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import java.util.ArrayList;
import java.util.List;
public class FPlayer
{

View File

@ -28,6 +28,7 @@ import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
@ -266,7 +267,7 @@ public class FUtil
}
catch (Exception e)
{
FLog.severe("Failed to convert name to UUID:\n" + e.toString());
FLog.severe("Failed to convert name to UUID:\n" + e);
}
return null;
}
@ -858,8 +859,8 @@ public class FUtil
public static int getFakePlayerCount()
{
int i = TotalFreedomMod.getPlugin().al.vanished.size();
for (String name : TotalFreedomMod.getPlugin().al.vanished)
int i = AdminList.vanished.size();
for (String name : AdminList.vanished)
{
if (Bukkit.getPlayer(name) == null)
{

View File

@ -111,7 +111,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
}
catch (Exception e)
{
log.severe("[CleanroomGenerator] Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e.toString());
log.severe("[CleanroomGenerator] Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e);
e.printStackTrace();
materials = new Material[65];