mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 13:46:45 +01:00
chore: Address false positive code style issues
This commit is contained in:
parent
6f4d2f6d5a
commit
4a2da59505
@ -218,6 +218,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
private PlatformWorldManager<World> worldManager;
|
||||
private Locale serverLocale;
|
||||
|
||||
@SuppressWarnings("StringSplitter")
|
||||
@Override
|
||||
public int @NonNull [] serverVersion() {
|
||||
if (this.version == null) {
|
||||
@ -242,6 +243,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
return Bukkit.getVersion();
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.pluginName = getDescription().getName();
|
||||
@ -746,7 +748,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
return Bukkit.getWorldContainer();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "CatchAndPrintStacktrace"})
|
||||
private void runEntityTask() {
|
||||
TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> {
|
||||
final World world = Bukkit.getWorld(plotArea.getWorldName());
|
||||
@ -970,7 +972,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -982,7 +983,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1223,7 +1223,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@SuppressWarnings("ALL")
|
||||
@SuppressWarnings("unchecked")
|
||||
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
|
||||
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
|
||||
}
|
||||
|
@ -461,6 +461,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
this.tamed.tamed = tamed.isTamed();
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Override
|
||||
public Entity spawn(World world, int xOffset, int zOffset) {
|
||||
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);
|
||||
|
@ -108,6 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return this.platformGenerator;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull List<BlockPopulator> getDefaultPopulators(@NonNull World world) {
|
||||
try {
|
||||
@ -153,6 +154,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return toAdd;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull ChunkData generateChunkData(
|
||||
@NonNull World world, @NonNull Random random, int x, int z,
|
||||
@ -195,6 +197,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return result.getChunkData();
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) {
|
||||
// Load if improperly loaded
|
||||
if (!this.loaded) {
|
||||
|
@ -66,6 +66,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
return PlotSquared.platform().defaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Override
|
||||
public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
|
||||
World world = BukkitUtil.getWorld(this.world);
|
||||
|
@ -89,6 +89,7 @@ public class BukkitModule extends AbstractModule {
|
||||
this.bukkitPlatform = bukkitPlatform;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(PlayerManager.class).to(BukkitPlayerManager.class);
|
||||
@ -132,6 +133,7 @@ public class BukkitModule extends AbstractModule {
|
||||
install(new FactoryModuleBuilder().build(ChunkCoordinatorBuilderFactory.class));
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Provides
|
||||
@Singleton
|
||||
@NonNull EconHandler provideEconHandler() {
|
||||
|
@ -35,6 +35,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class PermissionModule extends AbstractModule {
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Provides
|
||||
@Singleton
|
||||
PermissionHandler providePermissionHandler() {
|
||||
|
@ -203,6 +203,7 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingCasesInEnumSwitch")
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onPhysicsEvent(BlockPhysicsEvent event) {
|
||||
Block block = event.getBlock();
|
||||
@ -529,6 +530,7 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingCasesInEnumSwitch")
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockForm(BlockFormEvent event) {
|
||||
if (event instanceof EntityBlockFormEvent) {
|
||||
@ -684,6 +686,7 @@ public class BlockEventListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingCaseInEnumSwitch")
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFade(BlockFadeEvent event) {
|
||||
Block block = event.getBlock();
|
||||
|
@ -139,6 +139,7 @@ public class BlockEventListener117 implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingCasesInEnumSwitch")
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockForm(BlockFormEvent event) {
|
||||
Block block = event.getBlock();
|
||||
|
@ -88,6 +88,7 @@ public class ChunkListener implements Listener {
|
||||
private boolean ignoreUnload = false;
|
||||
private boolean isTrueForNotSave = true;
|
||||
|
||||
@SuppressWarnings({"StaticAssignmentInConstructor", "CatchAndPrintStackTrace"})
|
||||
@Inject
|
||||
public ChunkListener(final @NonNull PlotAreaManager plotAreaManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
|
@ -121,6 +121,7 @@ public class EntitySpawnListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingCaseInEnumSwitch")
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void creatureSpawnEvent(EntitySpawnEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
@ -159,6 +159,7 @@ public class PaperListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingCasesInEnumSwitch")
|
||||
@EventHandler
|
||||
public void onPreCreatureSpawnEvent(PreCreatureSpawnEvent event) {
|
||||
if (!Settings.Paper_Components.CREATURE_SPAWN) {
|
||||
@ -363,6 +364,7 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@EventHandler
|
||||
public void onAsyncTabCompletion(final AsyncTabCompleteEvent event) {
|
||||
if (!Settings.Paper_Components.ASYNC_TAB_COMPLETION) {
|
||||
|
@ -224,6 +224,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringSplitter")
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void playerCommand(PlayerCommandPreprocessEvent event) {
|
||||
String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
|
||||
@ -1667,6 +1668,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility
|
||||
@EventHandler
|
||||
public void onLocaleChange(final PlayerLocaleChangeEvent event) {
|
||||
// The event is fired before the player is deemed online upon login
|
||||
|
@ -43,12 +43,12 @@ import java.lang.reflect.Method;
|
||||
|
||||
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class SingleWorldListener implements Listener {
|
||||
|
||||
private final Method methodGetHandleChunk;
|
||||
private Field shouldSave;
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
public SingleWorldListener() throws Exception {
|
||||
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
||||
@ -69,6 +69,7 @@ public class SingleWorldListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
public void markChunkAsClean(Chunk chunk) {
|
||||
try {
|
||||
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
||||
|
@ -64,6 +64,7 @@ public class BukkitWorldManager implements PlatformWorldManager<World> {
|
||||
return Bukkit.createWorld(wc);
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
protected void setGenerator(final @Nullable String worldName, final @Nullable String generator) {
|
||||
if (generator == null) {
|
||||
return;
|
||||
|
@ -148,6 +148,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
private void callEvent(final @NonNull Event event) {
|
||||
final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||
for (final RegisteredListener listener : listeners) {
|
||||
@ -162,6 +163,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringSplitter")
|
||||
@Override
|
||||
@NonNegative
|
||||
public int hasPermissionRange(
|
||||
@ -319,7 +321,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
if (id == ItemTypes.AIR) {
|
||||
// Let's just stop all the discs because why not?
|
||||
for (final Sound sound : Arrays.stream(Sound.values())
|
||||
.filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) {
|
||||
.filter(sound -> sound.name().contains("DISC")).toList()) {
|
||||
player.stopSound(sound);
|
||||
}
|
||||
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
|
||||
@ -331,6 +333,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
|
||||
@Override
|
||||
public void kick(final String message) {
|
||||
this.player.kickPlayer(message);
|
||||
|
@ -193,6 +193,7 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
||||
/**
|
||||
* Requests a batch of chunks to be loaded
|
||||
*/
|
||||
@SuppressWarnings("FutureReturnValueIgnored")
|
||||
private void requestBatch() {
|
||||
BlockVector2 chunk;
|
||||
for (int i = 0; i < this.batchSize && (chunk = this.requestedChunks.poll()) != null; i++) {
|
||||
|
@ -199,7 +199,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
}
|
||||
}
|
||||
if (localChunk.getTiles().size() > 0) {
|
||||
localChunk.getTiles().forEach(((blockVector3, tag) -> {
|
||||
localChunk.getTiles().forEach((blockVector3, tag) -> {
|
||||
try {
|
||||
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
|
||||
getWorld().setBlock(blockVector3, block, noSideEffectSet);
|
||||
@ -207,7 +207,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
StateWrapper sw = new StateWrapper(tag);
|
||||
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (localChunk.getEntities().size() > 0) {
|
||||
localChunk.getEntities().forEach((location, entity) -> getWorld().createEntity(location, entity));
|
||||
|
@ -166,6 +166,7 @@ public class StateWrapper {
|
||||
return str;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
|
||||
public boolean restoreTag(String worldName, int x, int y, int z) {
|
||||
if (this.tag == null) {
|
||||
return false;
|
||||
|
@ -145,6 +145,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
||||
.toArray(PlotItemStack[]::new);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Need #getTitle for Spigot compatibility
|
||||
@Override
|
||||
public boolean isOpen(PlotInventory plotInventory) {
|
||||
if (!plotInventory.isOpen()) {
|
||||
|
@ -126,6 +126,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public String setupWorld(PlotAreaBuilder builder) {
|
||||
this.updateGenerators(false);
|
||||
|
@ -291,6 +291,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
return bukkitWorld.getMaxHeight() - 1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull String[] getSignSynchronous(final @NonNull Location location) {
|
||||
Block block = Objects.requireNonNull(getWorld(location.getWorldName())).getBlockAt(
|
||||
@ -570,6 +571,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
getChunkAt(chunk.getBlockX(), chunk.getBlockZ()).getTileEntities().length;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public Set<BlockVector2> getChunkChunks(String world) {
|
||||
Set<BlockVector2> chunks = super.getChunkChunks(world);
|
||||
|
@ -68,7 +68,7 @@ public class UpdateUtility implements Listener {
|
||||
"https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")
|
||||
.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
JsonObject result = (new JsonParser())
|
||||
JsonObject result = new JsonParser()
|
||||
.parse(new JsonReader(new InputStreamReader(connection.getInputStream())))
|
||||
.getAsJsonObject();
|
||||
spigotVersion = result.get("current_version").getAsString();
|
||||
|
@ -52,6 +52,7 @@ public class EssentialsUUIDService implements UUIDService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getUUIDs(final @NonNull List<String> usernames) {
|
||||
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
|
||||
|
@ -53,6 +53,7 @@ public class LuckPermsUUIDService implements UUIDService {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids) {
|
||||
final List<UUIDMapping> mappings = new ArrayList<>(uuids.size());
|
||||
@ -69,6 +70,7 @@ public class LuckPermsUUIDService implements UUIDService {
|
||||
return mappings;
|
||||
}
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getUUIDs(final @NonNull List<String> usernames) {
|
||||
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
|
||||
|
@ -43,6 +43,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public class OfflinePlayerUUIDService implements UUIDService {
|
||||
|
||||
@SuppressWarnings("EmptyCatch")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE || Bukkit.getWorlds().isEmpty()) {
|
||||
|
@ -49,6 +49,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
||||
|
||||
private final SQLite sqlite;
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
public SQLiteUUIDService(final String fileName) {
|
||||
this.sqlite =
|
||||
new SQLite(FileUtils.getFile(PlotSquared.platform().getDirectory(), fileName));
|
||||
@ -72,6 +73,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids) {
|
||||
final List<UUIDMapping> mappings = new ArrayList<>(uuids.size());
|
||||
@ -91,6 +93,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
||||
return mappings;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getUUIDs(@NonNull List<String> usernames) {
|
||||
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
|
||||
@ -113,6 +116,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
||||
return mappings;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public void accept(final List<UUIDMapping> uuidWrappers) {
|
||||
try (final PreparedStatement statement = getConnection()
|
||||
@ -132,6 +136,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
||||
*
|
||||
* @return All read mappings
|
||||
*/
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
public @NonNull List<UUIDMapping> getAll() {
|
||||
final List<UUIDMapping> mappings = new LinkedList<>();
|
||||
try (final PreparedStatement statement = getConnection().prepareStatement("SELECT * FROM `usercache`")) {
|
||||
|
@ -67,6 +67,7 @@ public class SquirrelIdUUIDService implements UUIDService {
|
||||
this.rateLimiter = RateLimiter.create(rateLimit / 600.0D);
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids) {
|
||||
final List<UUIDMapping> results = new ArrayList<>(uuids.size());
|
||||
@ -102,6 +103,7 @@ public class SquirrelIdUUIDService implements UUIDService {
|
||||
return results;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CatchAndPrintStackTrace")
|
||||
@Override
|
||||
public @NonNull List<UUIDMapping> getUUIDs(final @NonNull List<String> usernames) {
|
||||
final List<UUIDMapping> results = new ArrayList<>(usernames.size());
|
||||
|
Loading…
Reference in New Issue
Block a user