mirror of
https://github.com/taoneill/war.git
synced 2024-11-14 06:17:01 +01:00
closes gh-365 gh-392 Preparation time
This allows a prep time to be added IN SECONDS!!!! so /zonecfg preptime:<amount of time in secconds>
This commit is contained in:
parent
4f00befeb2
commit
eb7b600aef
@ -220,6 +220,7 @@ public class War extends JavaPlugin {
|
||||
warzoneDefaultConfig.put(WarzoneConfig.ALLOWENDER, true);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.RESETBLOCKS, true);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.CAPTUREPOINTTIME, 15);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.PREPTIME, 0);
|
||||
|
||||
teamDefaultConfig.put(TeamConfig.FLAGMUSTBEHOME, true);
|
||||
teamDefaultConfig.put(TeamConfig.FLAGPOINTSONLY, false);
|
||||
|
@ -8,6 +8,7 @@ import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.job.ZoneTimeJob;
|
||||
import com.tommytony.war.structure.*;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
|
||||
@ -137,6 +138,8 @@ public class Warzone {
|
||||
private boolean isReinitializing = false;
|
||||
//private final Object gameEndLock = new Object();
|
||||
|
||||
private boolean pvpReady = true;
|
||||
|
||||
public Warzone(World world, String name) {
|
||||
this.world = world;
|
||||
this.name = name;
|
||||
@ -144,6 +147,7 @@ public class Warzone {
|
||||
this.teamDefaultConfig = new TeamConfigBag(); // don't use ctor with Warzone, as this changes config resolution
|
||||
this.volume = new ZoneVolume(name, this.getWorld(), this);
|
||||
this.lobbyMaterials = War.war.getWarhubMaterials().clone();
|
||||
this.pvpReady = true;
|
||||
}
|
||||
|
||||
public static Warzone getZoneByName(String name) {
|
||||
@ -423,6 +427,17 @@ public class Warzone {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.reallyDeadFighters.clear();
|
||||
|
||||
//get them config (here be crazy grinning's!)
|
||||
int pvpready = warzoneConfig.getInt(WarzoneConfig.PREPTIME);
|
||||
|
||||
if(pvpready != 0) { //if it is equalz to zeroz then dinosaurs will take over the earth
|
||||
this.pvpReady = false;
|
||||
ZoneTimeJob timer = new ZoneTimeJob(this);
|
||||
War.war.getServer().getScheduler().runTaskLater(War.war, timer, pvpready * 20);
|
||||
}
|
||||
|
||||
// nom drops
|
||||
for(Entity entity : (this.getWorld().getEntities())) {
|
||||
if (!(entity instanceof Item)) {
|
||||
@ -2101,4 +2116,12 @@ public class Warzone {
|
||||
public boolean isThief(Player suspect) {
|
||||
return this.isFlagThief(suspect) || this.isBombThief(suspect) || this.isCakeThief(suspect);
|
||||
}
|
||||
|
||||
public void setPvpReady(boolean ready) {
|
||||
this.pvpReady = ready;
|
||||
}
|
||||
|
||||
public boolean getPvpReady() {
|
||||
return this.pvpReady;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ public enum WarzoneConfig {
|
||||
SOUPHEALING (Boolean.class, "Soup Healing", "If true, allow players to heal by consuming soup"),
|
||||
ALLOWENDER (Boolean.class, "Allow Ender Chests", "If true, ender chests are allowed\nEnder chests are usually blocked to prevent item duplication"),
|
||||
RESETBLOCKS (Boolean.class, "Reset Blocks", "If true, reset warzone blocks each battle"),
|
||||
CAPTUREPOINTTIME (Integer.class, "Capture Control Time", "Time, in seconds, required to gain control of a capture point");
|
||||
CAPTUREPOINTTIME (Integer.class, "Capture Control Time", "Time, in seconds, required to gain control of a capture point"),
|
||||
PREPTIME(Integer.class, "Preparation Time", "Time, in seconds, before players are allowed to fight");
|
||||
|
||||
|
||||
private final Class<?> configType;
|
||||
|
@ -482,3 +482,5 @@ public class WarBlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,6 +96,12 @@ public class WarEntityListener implements Listener {
|
||||
War.war.badMsg(a, "pvp.self.respawn");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!defenderWarzone.getPvpReady()) {
|
||||
//if the timer is still tickin we gotta handle defense! (there be notchz in virgina)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!attackerWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.PVPINZONE)) {
|
||||
|
22
war/src/main/java/com/tommytony/war/job/ZoneTimeJob.java
Normal file
22
war/src/main/java/com/tommytony/war/job/ZoneTimeJob.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.Warzone;
|
||||
|
||||
/**
|
||||
* @author grinning
|
||||
*/
|
||||
public class ZoneTimeJob implements Runnable {
|
||||
|
||||
private Warzone zone;
|
||||
|
||||
public ZoneTimeJob(Warzone zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
zone.setPvpReady(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user