About This plugin is used as an extension of ESpeedBuilder, which allows players to have more fun game modes
Every time a player places a block, there is a chance that it will disrupt their backpack!
There will be a hint to start the game, end the game, and every time you scramble your backpack
Config
Code (Text):
# Chaos Inventory Mode Configuration by Eternal Polar
# Color codes supported: Use & symbol (e.g., &6 for gold, &c for red)
# 1.16+ versions support hex colors: &x&R&G&B&R&G&B (e.g., &x&FF&55&00&FF&55&00)
# All messages support multi-line configuration
# 2. Enabled Worlds List (Empty list = Apply to all worlds; Fill with world names to apply only to specific worlds)
# Example: enabled-worlds: [ "ESpeedBuild1", "ESpeedBuild2" ]
enabled-worlds: []
# Message configuration
messages:
start:
- "&7=== Chaos Inventory Mode Started ==="
- "&eEvery block placement has a &c20%&e chance to shuffle your inventory"
- "&eGood luck and happy building!"
- "&7===================================="
end:
- "&6=== Chaos Inventory Mode Ended ==="
- "&eThanks for participating in the game!"
- "&6=================================="
chaos:
- "&c| &7Your inventory has been shuffled! &c|"
- "&7Quickly find the items you need to continue building!"
public class Mode implements ServerMode, Listener {
private static final Pattern HEX_COLOR_PATTERN = Pattern.compile("§x§[0-9A-Fa-f]§[0-9A-Fa-f]§[0-9A-Fa-f]§[0-9A-Fa-f]§[0-9A-Fa-f]§[0-9A-Fa-f]");
private static final Pattern VERSION_PATTERN = Pattern.compile("1\\.(\\d+)\\.");
private static final int MIN_VERSION_FOR_ISLOADED = 13;
private final JavaPlugin plugin;
private final Random random = new Random();
private final int serverVersion;
private List<String> enabledWorlds;
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
World playerWorld = player.getWorld();
if (playerWorld == null) {
return;
}
if (!enabledWorlds.isEmpty() && !enabledWorlds.contains(playerWorld.getName())) {
return;
}
if (random.nextDouble() <= chaosChance) {
shuffleInventory(player);
sendPlayerMessages(player, chaosMessages);
}
}