mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 20:46:41 +00:00
Removal of Lombok
Lombok implementation removal. I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!! Thank you!!
This commit is contained in:
@ -22,6 +22,46 @@ import org.bukkit.entity.Player;
|
||||
public class Command_ro extends FreedomCommand
|
||||
{
|
||||
|
||||
public static int replaceBlocks(Location center, Material fromMaterial, Material toMaterial, int radius)
|
||||
{
|
||||
int affected = 0;
|
||||
|
||||
Block centerBlock = center.getBlock();
|
||||
for (int xOffset = -radius; xOffset <= radius; xOffset++)
|
||||
{
|
||||
for (int yOffset = -radius; yOffset <= radius; yOffset++)
|
||||
{
|
||||
for (int zOffset = -radius; zOffset <= radius; zOffset++)
|
||||
{
|
||||
Block block = centerBlock.getRelative(xOffset, yOffset, zOffset);
|
||||
BlockData data = block.getBlockData();
|
||||
if (block.getLocation().distanceSquared(center) < (radius * radius))
|
||||
{
|
||||
if (fromMaterial.equals(Material.WATER) && data instanceof Waterlogged)
|
||||
{
|
||||
Waterlogged waterloggedData = (Waterlogged)data;
|
||||
if (waterloggedData.isWaterlogged())
|
||||
{
|
||||
waterloggedData.setWaterlogged(false);
|
||||
block.setBlockData(waterloggedData);
|
||||
affected++;
|
||||
continue;
|
||||
}
|
||||
block.setType(toMaterial);
|
||||
affected++;
|
||||
}
|
||||
else if (block.getType().equals(fromMaterial))
|
||||
{
|
||||
block.setType(toMaterial);
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -97,7 +137,7 @@ public class Command_ro extends FreedomCommand
|
||||
{
|
||||
adminWorld = plugin.wm.adminworld.getWorld();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
@ -134,47 +174,4 @@ public class Command_ro extends FreedomCommand
|
||||
FUtil.adminAction(sender.getName(), "Remove complete! " + affected + " blocks removed.", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int replaceBlocks(Location center, Material fromMaterial, Material toMaterial, int radius)
|
||||
{
|
||||
int affected = 0;
|
||||
|
||||
Block centerBlock = center.getBlock();
|
||||
for (int xOffset = -radius; xOffset <= radius; xOffset++)
|
||||
{
|
||||
for (int yOffset = -radius; yOffset <= radius; yOffset++)
|
||||
{
|
||||
for (int zOffset = -radius; zOffset <= radius; zOffset++)
|
||||
{
|
||||
Block block = centerBlock.getRelative(xOffset, yOffset, zOffset);
|
||||
BlockData data = block.getBlockData();
|
||||
if (block.getLocation().distanceSquared(center) < (radius * radius))
|
||||
{
|
||||
if (fromMaterial.equals(Material.WATER) && data instanceof Waterlogged)
|
||||
{
|
||||
if (data instanceof Waterlogged)
|
||||
{
|
||||
Waterlogged waterloggedData = (Waterlogged)data;
|
||||
if (waterloggedData.isWaterlogged())
|
||||
{
|
||||
waterloggedData.setWaterlogged(false);
|
||||
block.setBlockData(waterloggedData);
|
||||
affected++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
block.setType(toMaterial);
|
||||
affected++;
|
||||
}
|
||||
else if (block.getType().equals(fromMaterial))
|
||||
{
|
||||
block.setType(toMaterial);
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return affected;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user