2
0
Fork 0

Added command and config option to disable warbands

main
Shinare 7 months ago
parent fa32d55b05
commit c1b5d992fa

@ -25,6 +25,8 @@ public class CinderLoE_Config {
public static boolean objective_dale;
public static boolean objective_rhudaur;
public static boolean warbands_enabled;
public static void init(FMLPreInitializationEvent event) {
File configFile = new File(event.getModConfigurationDirectory(), "CinderLoE.cfg");
@ -55,6 +57,7 @@ public class CinderLoE_Config {
objective_dale = config.getBoolean("Dale", Configuration.CATEGORY_GENERAL, false, "set true if Dalish Objective Complete");
objective_rhudaur = config.getBoolean("Rhudaur", Configuration.CATEGORY_GENERAL, false, "set true if Rhudaur Objective Complete");
warbands_enabled = config.getBoolean("Warbands", Configuration.CATEGORY_GENERAL, true, "Set false to disable warbands");
// Save the configuration if it has changed
if (config.hasChanged()) {
config.save();

@ -1,5 +1,6 @@
package com.zivilon.cinder_loe.command;
import com.zivilon.cinder_loe.CinderLoE_Config;
import com.zivilon.cinder_loe.world.event.Warband;
import com.zivilon.cinder_loe.world.event.WarbandFaction;
@ -24,7 +25,7 @@ public class CommandWarband extends CommandBase {
@Override
public String getCommandUsage(ICommandSender sender) {
return "/warband <summon/reset> [faction_name] [waypoint] [x] [z]";
return "/warband <summon/reset/list/on/off> [faction_name] [waypoint] [x] [z]";
}
@Override
@ -52,6 +53,14 @@ public class CommandWarband extends CommandBase {
case "summon":
summon_warband(sender, args);
return;
case "on":
CinderLoE_Config.warbands_enabled = true;
sender.addChatMessage(new ChatComponentText("Warbands have been enabled!"));
return;
case "off":
CinderLoE_Config.warbands_enabled = true;
sender.addChatMessage(new ChatComponentText("Warbands have been disabled!"));
return;
}
}
@ -119,7 +128,7 @@ public class CommandWarband extends CommandBase {
public static boolean validate_args(String[] args) {
if (args.length < 1) return false;
String action = "";
if (args[0].equals("summon") || args[0].equals("reset") || args[0].equals("list")) {
if (args[0].equals("summon") || args[0].equals("reset") || args[0].equals("list") || args[0].equals("on") || args[0].equals("off")) {
action = args[0];
} else {
return false;

@ -37,7 +37,7 @@ import java.util.UUID;
public class Warband {
public static Random random = new Random();
public static World world;;
public static World world;
public static long last_warband_timestamp = System.currentTimeMillis() / 1000L - (60*60*2); // Initialize at 2 hour cooldown on server startup
static {

@ -1,5 +1,7 @@
package com.zivilon.cinder_loe.world.event;
import com.zivilon.cinder_loe.CinderLoE_Config;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
@ -23,6 +25,7 @@ public class WarbandTickHandler {
public void run_task() {
if (Warband.last_warband_timestamp > (System.currentTimeMillis() / 1000L) - (60*60*4)) return; // Do not spawn warband if less than 4 hours since last one
if (Warband.random.nextInt(10) != 0) return;
if (!CinderLoE_Config.warbands_enabled) return;
Warband.initialize_warband();
}
}

Loading…
Cancel
Save