-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added default config - Raised default analyze speed - Raised default section size - Fixed resets instantly resetting arenas when using slower speeds on larger arenas (math rounding error) - Arenas now reset each section relative to how many blocks that sections has. So no section will complete way faster than others - For extremely slow speeds, sections are now reshuffled to make priority for ones that did not get to reset at all for the next tick - equals() and hashCode() are now overriden in Arena and Section to be more accurate
- Loading branch information
1 parent
44a6cdb
commit b92833d
Showing
13 changed files
with
293 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,64 @@ | ||
package com.strangeone101.platinumarenas; | ||
|
||
import org.bukkit.configuration.InvalidConfigurationException; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
public class ConfigManager { | ||
|
||
/** | ||
* How many blocks to analyze/count before waiting a bit before continuing. | ||
*/ | ||
public static final int BLOCKS_ANALYZED_PER_SECOND = 40_000; | ||
public static int BLOCKS_ANALYZED_PER_SECOND = 49_600; | ||
|
||
/** | ||
* How many blocks can be per section in arenas. Max is 2,147,483,647 | ||
*/ | ||
public static final int BLOCKS_PER_SECTION = 10000; //2_097_152; | ||
public static int BLOCKS_PER_SECTION = 28_800; | ||
|
||
public static int BLOCKS_RESET_PER_SECOND_VERYSLOW = 10 * 20; | ||
public static int BLOCKS_RESET_PER_SECOND_SLOW = 50 * 20; | ||
public static int BLOCKS_RESET_PER_SECOND_NORMAL = 500 * 20; | ||
public static int BLOCKS_RESET_PER_SECOND_FAST = 2000 * 20; | ||
public static int BLOCKS_RESET_PER_SECOND_VERYFAST = 5000 * 20; | ||
public static int BLOCKS_RESET_PER_SECOND_EXTREME = 10000 * 20; | ||
|
||
private static YamlConfiguration config; | ||
|
||
public static boolean setup() { | ||
File file = new File(PlatinumArenas.INSTANCE.getDataFolder(), "config.yml"); | ||
if (!file.exists()) { | ||
if (!Util.saveResource("config.yml", file)) { | ||
PlatinumArenas.INSTANCE.getLogger().severe("Failed to copy default config!"); | ||
return false; | ||
} | ||
} | ||
config = new YamlConfiguration(); | ||
try { | ||
config.load(file); | ||
|
||
BLOCKS_ANALYZED_PER_SECOND = config.getInt("AnalyzeBlockSpeed", BLOCKS_ANALYZED_PER_SECOND); | ||
|
||
BLOCKS_PER_SECTION = config.getInt("MaxSectionSize", BLOCKS_PER_SECTION); | ||
|
||
@Deprecated | ||
public static final int BLOCKS_RESET_PER_SECOND = 20_000; | ||
BLOCKS_RESET_PER_SECOND_VERYSLOW = config.getInt("Speeds.VerySlow", BLOCKS_RESET_PER_SECOND_VERYSLOW); | ||
BLOCKS_RESET_PER_SECOND_SLOW = config.getInt("Speeds.Slow", BLOCKS_RESET_PER_SECOND_SLOW); | ||
BLOCKS_RESET_PER_SECOND_NORMAL = config.getInt("Speeds.Normal", BLOCKS_RESET_PER_SECOND_NORMAL); | ||
BLOCKS_RESET_PER_SECOND_FAST = config.getInt("Speeds.Fast", BLOCKS_RESET_PER_SECOND_FAST); | ||
BLOCKS_RESET_PER_SECOND_VERYFAST = config.getInt("Speeds.VeryFast", BLOCKS_RESET_PER_SECOND_VERYFAST); | ||
BLOCKS_RESET_PER_SECOND_EXTREME = config.getInt("Speeds.Extreme", BLOCKS_RESET_PER_SECOND_EXTREME); | ||
|
||
public static final int BLOCKS_RESET_PER_SECOND_VERYSLOW = 10 * 20; | ||
public static final int BLOCKS_RESET_PER_SECOND_SLOW = 50 * 20; | ||
public static final int BLOCKS_RESET_PER_SECOND_NORMAL = 500 * 20; | ||
public static final int BLOCKS_RESET_PER_SECOND_FAST = 2000 * 20; | ||
public static final int BLOCKS_RESET_PER_SECOND_VERYFAST = 5000 * 20; | ||
public static final int BLOCKS_RESET_PER_SECOND_EXTREME = 10000 * 20; | ||
return true; | ||
} catch (IOException e) { | ||
PlatinumArenas.INSTANCE.getLogger().severe("Failed to load config.yml!"); | ||
e.printStackTrace(); | ||
return false; | ||
} catch (InvalidConfigurationException e) { | ||
PlatinumArenas.INSTANCE.getLogger().severe("Invalid YML format used in config.yml!"); | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.