Add schem deadline message to /event
Dieser Commit ist enthalten in:
Ursprung
352497f658
Commit
e7b7cc01bc
@ -20,10 +20,7 @@
|
|||||||
package de.steamwar.bungeecore.commands;
|
package de.steamwar.bungeecore.commands;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.*;
|
import de.steamwar.bungeecore.*;
|
||||||
import de.steamwar.bungeecore.sql.Event;
|
import de.steamwar.bungeecore.sql.*;
|
||||||
import de.steamwar.bungeecore.sql.EventFight;
|
|
||||||
import de.steamwar.bungeecore.sql.Team;
|
|
||||||
import de.steamwar.bungeecore.sql.TeamTeilnahme;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
|
||||||
@ -84,6 +81,10 @@ public class EventCommand extends BasicCommand {
|
|||||||
if(now.isBefore(e.getDeadline().toInstant())) {
|
if(now.isBefore(e.getDeadline().toInstant())) {
|
||||||
Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline());
|
Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline());
|
||||||
}
|
}
|
||||||
|
SchematicType schematicType = SchematicType.get(e);
|
||||||
|
if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) {
|
||||||
|
Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline());
|
||||||
|
}
|
||||||
if(!teams.isEmpty()){
|
if(!teams.isEmpty()){
|
||||||
StringBuilder tline = new StringBuilder();
|
StringBuilder tline = new StringBuilder();
|
||||||
for(Team t : teams){
|
for(Team t : teams){
|
||||||
|
@ -27,14 +27,17 @@ import net.md_5.bungee.config.YamlConfiguration;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class SchematicType {
|
public class SchematicType {
|
||||||
public static final SchematicType Normal = new SchematicType("Normal", "", null, Type.NORMAL, null); //Has to stay publicly availible
|
public static final SchematicType Normal = new SchematicType("Normal", "", null, Type.NORMAL, null, null); //Has to stay publicly availible
|
||||||
|
|
||||||
private static final Map<String, SchematicType> fromDB;
|
private static final Map<String, SchematicType> fromDB;
|
||||||
private static final Map<SchematicType, SchematicType> fightType;
|
private static final Map<SchematicType, SchematicType> fightType;
|
||||||
private static final List<SchematicType> types;
|
private static final List<SchematicType> types;
|
||||||
|
private static final Map<Integer, SchematicType> eventSchematicTypes;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
File folder = new File(ProxyServer.getInstance().getPluginsFolder(), "FightSystem");
|
File folder = new File(ProxyServer.getInstance().getPluginsFolder(), "FightSystem");
|
||||||
@ -42,6 +45,7 @@ public class SchematicType {
|
|||||||
List<SchematicType> tmpTypes = new LinkedList<>();
|
List<SchematicType> tmpTypes = new LinkedList<>();
|
||||||
Map<String, SchematicType> tmpFromDB = new HashMap<>();
|
Map<String, SchematicType> tmpFromDB = new HashMap<>();
|
||||||
Map<SchematicType, SchematicType> tmpFightType = new HashMap<>();
|
Map<SchematicType, SchematicType> tmpFightType = new HashMap<>();
|
||||||
|
Map<Integer, SchematicType> tmpEventType = new HashMap<>();
|
||||||
|
|
||||||
tmpTypes.add(Normal);
|
tmpTypes.add(Normal);
|
||||||
tmpFromDB.put(Normal.name().toLowerCase(), Normal);
|
tmpFromDB.put(Normal.name().toLowerCase(), Normal);
|
||||||
@ -68,22 +72,41 @@ public class SchematicType {
|
|||||||
|
|
||||||
SchematicType checktype = null;
|
SchematicType checktype = null;
|
||||||
if(!config.getStringList("CheckQuestions").isEmpty()) {
|
if(!config.getStringList("CheckQuestions").isEmpty()) {
|
||||||
checktype = new SchematicType("C" + type, "C" + shortcut, material, Type.CHECK_TYPE, null);
|
checktype = new SchematicType("C" + type, "C" + shortcut, material, Type.CHECK_TYPE, null, null);
|
||||||
tmpTypes.add(checktype);
|
tmpTypes.add(checktype);
|
||||||
tmpFromDB.put(checktype.toDB(), checktype);
|
tmpFromDB.put(checktype.toDB(), checktype);
|
||||||
CheckCommand.setCheckQuestions(checktype, config);
|
CheckCommand.setCheckQuestions(checktype, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
SchematicType current = new SchematicType(type, shortcut, material, config.getKeys().contains("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype);
|
Date deadline;
|
||||||
|
String deadlineString = config.getString("deadline", null);
|
||||||
|
if (deadlineString != null) {
|
||||||
|
try {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
|
||||||
|
deadline = dateFormat.parse(deadlineString);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new SecurityException(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deadline = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
SchematicType current = new SchematicType(type, shortcut, material, config.getKeys().contains("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype, deadline);
|
||||||
if(checktype != null)
|
if(checktype != null)
|
||||||
tmpFightType.put(checktype, current);
|
tmpFightType.put(checktype, current);
|
||||||
tmpFromDB.put(type.toLowerCase(), current);
|
tmpFromDB.put(type.toLowerCase(), current);
|
||||||
|
|
||||||
|
Integer eventID = config.get("eventID", null);
|
||||||
|
if (eventID != null) {
|
||||||
|
tmpEventType.put(eventID, current);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fromDB = Collections.unmodifiableMap(tmpFromDB);
|
fromDB = Collections.unmodifiableMap(tmpFromDB);
|
||||||
fightType = Collections.unmodifiableMap(tmpFightType);
|
fightType = Collections.unmodifiableMap(tmpFightType);
|
||||||
types = Collections.unmodifiableList(tmpTypes);
|
types = Collections.unmodifiableList(tmpTypes);
|
||||||
|
eventSchematicTypes = Collections.unmodifiableMap(tmpEventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -91,13 +114,15 @@ public class SchematicType {
|
|||||||
private final String material;
|
private final String material;
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private final SchematicType checkType;
|
private final SchematicType checkType;
|
||||||
|
private final Date deadline;
|
||||||
|
|
||||||
private SchematicType(String name, String kuerzel, String material, Type type, SchematicType checkType){
|
private SchematicType(String name, String kuerzel, String material, Type type, SchematicType checkType, Date deadline){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.kuerzel = kuerzel;
|
this.kuerzel = kuerzel;
|
||||||
this.material = material != null && !"".equals(material) ? material : "STONE_BUTTON";
|
this.material = material != null && !"".equals(material) ? material : "STONE_BUTTON";
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.checkType = checkType;
|
this.checkType = checkType;
|
||||||
|
this.deadline = deadline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAssignable(){
|
public boolean isAssignable(){
|
||||||
@ -140,6 +165,10 @@ public class SchematicType {
|
|||||||
return name.toLowerCase();
|
return name.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date deadline() {
|
||||||
|
return deadline;
|
||||||
|
}
|
||||||
|
|
||||||
public static SchematicType fromDB(String input){
|
public static SchematicType fromDB(String input){
|
||||||
return fromDB.getOrDefault(input.toLowerCase(), null);
|
return fromDB.getOrDefault(input.toLowerCase(), null);
|
||||||
}
|
}
|
||||||
@ -148,6 +177,10 @@ public class SchematicType {
|
|||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SchematicType get(Event event) {
|
||||||
|
return eventSchematicTypes.get(event.getEventID());
|
||||||
|
}
|
||||||
|
|
||||||
enum Type{
|
enum Type{
|
||||||
NORMAL,
|
NORMAL,
|
||||||
CHECK_TYPE,
|
CHECK_TYPE,
|
||||||
|
@ -238,6 +238,7 @@ EVENT_NO_CURRENT=§cThere is no event taking place currently
|
|||||||
EVENT_COMING=§eUpcoming events§8:
|
EVENT_COMING=§eUpcoming events§8:
|
||||||
EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2}
|
EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2}
|
||||||
EVENT_COMING_DEADLINE=§7 Registration deadline§8: §7{0}
|
EVENT_COMING_DEADLINE=§7 Registration deadline§8: §7{0}
|
||||||
|
EVENT_COMING_SCHEM_DEADLINE=§7 Schematic deadline§8: §7{0}
|
||||||
EVENT_COMING_TEAMS=§7 With§8:{0}
|
EVENT_COMING_TEAMS=§7 With§8:{0}
|
||||||
EVENT_COMING_TEAM= §{0}{1}
|
EVENT_COMING_TEAM= §{0}{1}
|
||||||
EVENT_CURRENT_EVENT=§e§l{0}
|
EVENT_CURRENT_EVENT=§e§l{0}
|
||||||
|
@ -222,6 +222,7 @@ EVENT_NO_CURRENT=§cDerzeit findet kein Event statt
|
|||||||
EVENT_COMING=§eKommende Events§8:
|
EVENT_COMING=§eKommende Events§8:
|
||||||
EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2}
|
EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2}
|
||||||
EVENT_COMING_DEADLINE=§7 Anmeldeschluss§8: §7{0}
|
EVENT_COMING_DEADLINE=§7 Anmeldeschluss§8: §7{0}
|
||||||
|
EVENT_COMING_SCHEM_DEADLINE=§7 Einsendeschluss§8: §7{0}
|
||||||
EVENT_COMING_TEAMS=§7 Mit§8:{0}
|
EVENT_COMING_TEAMS=§7 Mit§8:{0}
|
||||||
EVENT_COMING_TEAM= §{0}{1}
|
EVENT_COMING_TEAM= §{0}{1}
|
||||||
EVENT_CURRENT_EVENT=§e§l{0}
|
EVENT_CURRENT_EVENT=§e§l{0}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren