Add pvpAutoPause rule (#8249)
* Update Rules.java * Update NetServer.java
This commit is contained in:
@@ -869,7 +869,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(state.isGame() && net.server()){
|
if(state.isGame() && net.server()){
|
||||||
if(state.rules.pvp){
|
if(state.rules.pvp && state.rules.pvpAutoPause){
|
||||||
boolean waiting = isWaitingForPlayers(), paused = state.isPaused();
|
boolean waiting = isWaitingForPlayers(), paused = state.isPaused();
|
||||||
if(waiting != paused){
|
if(waiting != paused){
|
||||||
if(waiting){
|
if(waiting){
|
||||||
@@ -1003,7 +1003,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
player.con.snapshotsSent++;
|
player.con.snapshotsSent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
String fixName(String name){
|
public String fixName(String name){
|
||||||
name = name.trim().replace("\n", "").replace("\t", "");
|
name = name.trim().replace("\n", "").replace("\t", "");
|
||||||
if(name.equals("[") || name.equals("]")){
|
if(name.equals("[") || name.equals("]")){
|
||||||
return "";
|
return "";
|
||||||
@@ -1027,7 +1027,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String checkColor(String str){
|
public String checkColor(String str){
|
||||||
for(int i = 1; i < str.length(); i++){
|
for(int i = 1; i < str.length(); i++){
|
||||||
if(str.charAt(i) == ']'){
|
if(str.charAt(i) == ']'){
|
||||||
String color = str.substring(1, i);
|
String color = str.substring(1, i);
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public class Rules{
|
|||||||
public boolean waves;
|
public boolean waves;
|
||||||
/** Whether the game objective is PvP. Note that this enables automatic hosting. */
|
/** Whether the game objective is PvP. Note that this enables automatic hosting. */
|
||||||
public boolean pvp;
|
public boolean pvp;
|
||||||
|
/** Whether is waiting for players enabled in PvP. */
|
||||||
|
public boolean pvpAutoPause = true;
|
||||||
/** Whether to pause the wave timer until all enemies are destroyed. */
|
/** Whether to pause the wave timer until all enemies are destroyed. */
|
||||||
public boolean waitEnemies = false;
|
public boolean waitEnemies = false;
|
||||||
/** Determines if gamemode is attack mode. */
|
/** Determines if gamemode is attack mode. */
|
||||||
|
|||||||
Reference in New Issue
Block a user