diff --git a/README.md b/README.md index f0611c1..671b502 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Let's fight X-Ray cheat with simple Math! +![XRayMonitor Logo](XRayMonitor.png?raw=true "XRayMonitor Logo") This simple plugin monitors players' mining activity and detects potential X-Ray cheating through statistical analysis. When a player mines significantly more valuable ores (like diamonds, gold, emeralds) compared to common blocks (like stone, coal), the plugin flags them for potential cheating. The detection is based on configurable thresholds, allowing server admins to customize sensitivity according to their needs, and uses [LogBlock](https://www.spigotmc.org/resources/logblock.67333/) data to analyze mining patterns over time. This plugin requires Java 21 or higher and is compatible with Minecraft server versions 1.20.x and above. Also, it supports both Paper and Spigot server implementations. @@ -29,6 +30,29 @@ The configuration file `config.yml` is created in the plugin's folder after the - `/xrm Player world:survival` - Check a specific player's mining activity in a specific world. - `/xrm all ore:diamond_ore rate:3` - Check all players' mining activity for diamond ore with a rate of 3. +## Adding New Materials in the code + +### Easy Extension Process: +1. **Add Message Entry** (in Messages.java): + ```java + Quartz("quartz", "§6Quartz: §a%s"), + ``` + +2. **Add Configuration Entry** (in Checkers.java): + ```java + put("quartz", new OreConfig("quartz", Messages.Quartz, 2.0f, + Arrays.asList("nether_quartz_ore"), true)); + ``` + +### Example Future Materials: +```java +// Future Minecraft materials +put("ruby", new OreConfig("ruby", Messages.Ruby, 12.0f, + Arrays.asList("ruby_ore", "deepslate_ruby_ore"))); +put("amethyst", new OreConfig("amethyst", Messages.Amethyst, 5.0f, + Arrays.asList("amethyst_cluster", "budding_amethyst"))); +``` + ## Support If you encounter a bug, please open an issue with detailed information. I maintain this in my spare time, so fixes may take a while, but I'll address them when possible. diff --git a/REFACTORING_SUMMARY.md b/REFACTORING_SUMMARY.md deleted file mode 100644 index 454d692..0000000 --- a/REFACTORING_SUMMARY.md +++ /dev/null @@ -1,76 +0,0 @@ -# Checkers.java Summary - -## Overview -The `Checkers.java` file provides a maintainable, extensible architecture for handling different ore types in the X-Ray monitoring system. - -## Key Principles - -### 1. **Data-Driven Configuration** -```java -private static final Map ORE_CONFIGS = new HashMap() {{ - put("diamond", new OreConfig("diamond", Messages.Diamond, 10.0f, - Arrays.asList("diamond_ore", "deepslate_diamond_ore"))); - put("emerald", new OreConfig("emerald", Messages.Emerald, 10.0f, - Arrays.asList("emerald_ore", "deepslate_emerald_ore"))); - // ... more ore configurations -}}; -``` - -### 2. **Modular Architecture** -- **OreConfig Class**: Encapsulates ore-specific configuration - - `configKey`: Configuration key for the ore type - - `message`: Display message enum - - `levelMultiplier`: Impact on X-ray suspicion level - - `oreVariants`: List of block types (supports regular + deepslate variants) - - `useNetherStones`: Whether to use nether stones for percentage calculation - -- **OreLookupResult Class**: Data container for lookup results - - `count`: Number of ores found - - `stoneCount`: Base stone count for percentage calculation - -### 3. **Helper Methods for Better Code Organization** -- `getOreCounts()`: Batch retrieval of ore counts -- `processOreType()`: Single ore type processing -- `calculateAndDisplayOre()`: Ore percentage calculation and display -- `determineOreColor()`: Color determination based on rates -- `formatPercentage()`: Consistent percentage formatting - -## Adding New Materials - -### Easy Extension Process: -1. **Add Message Entry** (in Messages.java): - ```java - Quartz("quartz", "§6Quartz: §a%s"), - ``` - -2. **Add Configuration Entry** (in Checkers.java): - ```java - put("quartz", new OreConfig("quartz", Messages.Quartz, 2.0f, - Arrays.asList("nether_quartz_ore"), true)); - ``` - -### Example Future Materials: -```java -// Future Minecraft materials -put("ruby", new OreConfig("ruby", Messages.Ruby, 12.0f, - Arrays.asList("ruby_ore", "deepslate_ruby_ore"))); -put("amethyst", new OreConfig("amethyst", Messages.Amethyst, 5.0f, - Arrays.asList("amethyst_cluster", "budding_amethyst"))); -``` - -## Testing Results - -### Test Coverage: -- **21 Total Tests**: All passing ✅ -- **ConfigTest**: 6 tests passing -- **CustomizableMessageTest**: 5 tests passing -- **MessagesTest**: 5 tests passing -- **CheckersTest**: 5 tests passing - -## Future Development - -### Recommended Next Steps: -1. **Configuration File Integration**: Move ore configurations to external files -2. **Dynamic Loading**: Support runtime addition of new ore types -3. **Plugin Integration**: Add hooks for other plugins to register custom ores -4. **Performance Monitoring**: Add metrics for ore processing performance diff --git a/XRayMonitor.png b/XRayMonitor.png new file mode 100644 index 0000000..e5c7a4b Binary files /dev/null and b/XRayMonitor.png differ