mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
We dont use javadoc & format fixes
This commit is contained in:
parent
76bb2d08ac
commit
a0b29c1d01
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,6 +23,7 @@ manifest.mf
|
||||
/.idea/discord.xml
|
||||
/.idea/jarRepositories.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/uiDesigner.xml
|
||||
/.idea/libraries
|
||||
*.iml
|
||||
|
||||
|
@ -115,11 +115,6 @@ public class Monitors extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of potions the player has thrown with unix time stamps.
|
||||
* @param player The player that has thrown potions.
|
||||
* @return A list of map entries with the key as the thrown potion and the value as a long (unix time stamp when the throw happened).
|
||||
*/
|
||||
public List<Map.Entry<ThrownPotion, Long>> getPlayerThrownPotions(Player player)
|
||||
{
|
||||
List<Map.Entry<ThrownPotion, Long>> thrownPotions = new ArrayList<>();
|
||||
@ -136,11 +131,6 @@ public class Monitors extends FreedomService
|
||||
return thrownPotions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects if a thrown potion is most likely a troll potion.
|
||||
* @param potion Any thrown potion that should be checked.
|
||||
* @return A boolean that indicates if the potion param is most likely a troll potion.
|
||||
*/
|
||||
public boolean isTrollPotion(ThrownPotion potion)
|
||||
{
|
||||
int badEffectsDetected = 0;
|
||||
|
@ -13,17 +13,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
/**
|
||||
* Links TF-FAWE and the CoreProtect API together with two functions.
|
||||
* @author CoolJWB
|
||||
*/
|
||||
public class FAWEBridge extends FreedomService
|
||||
{
|
||||
private CoreProtectAPI api;
|
||||
@ -39,7 +34,7 @@ public class FAWEBridge extends FreedomService
|
||||
/*
|
||||
* Iterates over blocks placed by GenerationCommands (in the EditSession) and adds them to the CoreProtect logs.
|
||||
*/
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
|
||||
server.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
@ -60,9 +55,9 @@ public class FAWEBridge extends FreedomService
|
||||
if (blockVector3 != null)
|
||||
{
|
||||
EditSession editSession = playerAndSessionEntry.getValue();
|
||||
World world = Bukkit.getWorld(editSession.getWorld().getName());
|
||||
World world = server.getWorld(editSession.getWorld().getName());
|
||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
BlockData blockData = Bukkit.createBlockData(dataAndVectorEntry.get(blockVector3));
|
||||
BlockData blockData = server.createBlockData(dataAndVectorEntry.get(blockVector3));
|
||||
api.logRemoval(playerAndSessionEntry.getKey(), location, blockData.getMaterial(), blockData);
|
||||
}
|
||||
}
|
||||
@ -85,7 +80,7 @@ public class FAWEBridge extends FreedomService
|
||||
{
|
||||
if (blockVector3 != null && !pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
||||
{
|
||||
World world = Bukkit.getWorld(playerAndSessionEntry.getValue().getWorld().getName());
|
||||
World world = server.getWorld(playerAndSessionEntry.getValue().getWorld().getName());
|
||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
BaseBlock block = pattern.apply(blockVector3);
|
||||
Material material = Material.getMaterial(block.getBlockType().getId().replaceFirst("minecraft:", "").toUpperCase());
|
||||
@ -106,19 +101,13 @@ public class FAWEBridge extends FreedomService
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a single block edit to CoreProtect.
|
||||
* @param playerName The name of the player.
|
||||
* @param editSession A WorldEdit edit session to find the world.
|
||||
* @param pattern A WorldEdit pattern for the new block placed.
|
||||
* @param blockVector3 A WorldEdit BlockVector3 for coordinates.
|
||||
*/
|
||||
|
||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, BlockVector3 blockVector3)
|
||||
{
|
||||
// Cache the world used for the next iterations to come.
|
||||
if (world == null || !world.getName().equals(editSession.getWorld().getName()))
|
||||
{
|
||||
world = Bukkit.getWorld(editSession.getWorld().getName());
|
||||
world = server.getWorld(editSession.getWorld().getName());
|
||||
}
|
||||
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||
@ -142,17 +131,10 @@ public class FAWEBridge extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a pattern within a region to CoreProtect.
|
||||
* @param playerName The name of the player.
|
||||
* @param editSession A WorldEdit edit session to find the world.
|
||||
* @param region A region of blocks.
|
||||
* @param pattern A WorldEdit pattern for the new blocks placed.
|
||||
*/
|
||||
public void logBlockEdits(String playerName, EditSession editSession, Region region, Pattern pattern)
|
||||
{
|
||||
// Add the broken blocks to CoreProtect.
|
||||
World world = Bukkit.getWorld(region.getWorld().getName());
|
||||
World world = server.getWorld(region.getWorld().getName());
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
|
||||
for (BlockVector3 blockVector3 : region)
|
||||
@ -163,18 +145,11 @@ public class FAWEBridge extends FreedomService
|
||||
logBlockEdit(playerName, editSession, pattern, blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a list of block edits to CoreProtect.
|
||||
* @param playerName The name of the player.
|
||||
* @param editSession A WorldEdit edit session to find the world.
|
||||
* @param pattern A WorldEdit pattern for the new block placed.
|
||||
* @param blocks A list of blocks.
|
||||
*/
|
||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, List<Block> blocks)
|
||||
{
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
server.getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
{
|
||||
for (Block block : blocks)
|
||||
{
|
||||
|
@ -176,11 +176,6 @@ public class Command_potionspy extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets and updates the potion spy state for an admin.
|
||||
* @param admin The admin that the state should be changed for.
|
||||
* @param state A boolean that will set the state of potion spy for the admin (enabled or disabled).
|
||||
*/
|
||||
private void setPotionSpyState(Admin admin, boolean state)
|
||||
{
|
||||
admin.setPotionSpy(state);
|
||||
|
@ -782,13 +782,6 @@ public class FUtil
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects if two colors are alike.
|
||||
* @param first The first Color to check.
|
||||
* @param second The second Color to check.
|
||||
* @param tresHold The maximum allowed difference between the colors.
|
||||
* @return Returns true if the colors are alike.
|
||||
*/
|
||||
public static boolean colorClose(Color first, Color second, int tresHold)
|
||||
{
|
||||
int redDelta = Math.abs(first.getRed() - second.getRed());
|
||||
|
Loading…
Reference in New Issue
Block a user