Upload folder via GUI - src

This commit is contained in:
Git Manager GUI
2026-04-08 02:42:04 +02:00
parent 4e18de17fc
commit 87f80d30c5
16 changed files with 1160 additions and 22 deletions

View File

@@ -34,12 +34,17 @@ public class EventDefinition {
private boolean inRotation;
// Gewichtung in der Rotation
private int weight;
// Optionaler Start-/Zielbereich (Rennen)
private EventRegion startRegion;
private EventRegion goalRegion;
// Custom-Einstellungen (Key-Value)
private Map<String, Object> customSettings;
// Ist es ein benutzerdefiniertes Event?
private boolean isCustom;
// Optionale Event-Region (null = gesamte Welt)
private EventRegion region;
// Winner-Belohnungen (nur Sieger)
private List<String> winnerRewards;
// ─── Konstruktor für builtin Events ────────────────────────────────────
public EventDefinition(EventType type) {
@@ -57,8 +62,11 @@ public class EventDefinition {
this.announcement = ColorUtil.color("&6✦ &e" + displayName + " &6startet jetzt!");
this.inRotation = true;
this.weight = 1;
this.startRegion = null;
this.goalRegion = null;
this.customSettings = new HashMap<>();
this.isCustom = false;
this.winnerRewards = new ArrayList<>();
}
// ─── Konstruktor für Custom Events ─────────────────────────────────────
@@ -77,8 +85,11 @@ public class EventDefinition {
this.announcement = ColorUtil.color("&6✦ &e" + id + " &6startet jetzt!");
this.inRotation = true;
this.weight = 1;
this.startRegion = null;
this.goalRegion = null;
this.customSettings = new HashMap<>();
this.isCustom = true;
this.winnerRewards = new ArrayList<>();
}
// ─── Laden aus ConfigurationSection ────────────────────────────────────
@@ -96,6 +107,7 @@ public class EventDefinition {
"&6✦ &e" + def.displayName + " &6startet jetzt!"));
def.inRotation = sec.getBoolean("in-rotation", true);
def.weight = sec.getInt("weight", 1);
def.winnerRewards = sec.getStringList("winner-rewards");
String catStr = sec.getString("category", "CUSTOM");
try { def.category = EventCategory.valueOf(catStr); }
catch (Exception e) { def.category = EventCategory.CUSTOM; }
@@ -120,6 +132,32 @@ public class EventDefinition {
def.region = new EventRegion(w, minX, minY, minZ, maxX, maxY, maxZ);
} catch (Exception ignored) {}
}
// Start-/Zielregion laden
if (sec.contains("start-region.world")) {
try {
String w = sec.getString("start-region.world");
int minX = sec.getInt("start-region.min-x");
int minY = sec.getInt("start-region.min-y");
int minZ = sec.getInt("start-region.min-z");
int maxX = sec.getInt("start-region.max-x");
int maxY = sec.getInt("start-region.max-y");
int maxZ = sec.getInt("start-region.max-z");
def.startRegion = new EventRegion(w, minX, minY, minZ, maxX, maxY, maxZ);
} catch (Exception ignored) {}
}
if (sec.contains("goal-region.world")) {
try {
String w = sec.getString("goal-region.world");
int minX = sec.getInt("goal-region.min-x");
int minY = sec.getInt("goal-region.min-y");
int minZ = sec.getInt("goal-region.min-z");
int maxX = sec.getInt("goal-region.max-x");
int maxY = sec.getInt("goal-region.max-y");
int maxZ = sec.getInt("goal-region.max-z");
def.goalRegion = new EventRegion(w, minX, minY, minZ, maxX, maxY, maxZ);
} catch (Exception ignored) {}
}
return def;
}
@@ -136,6 +174,7 @@ public class EventDefinition {
sec.set("announcement", announcement);
sec.set("in-rotation", inRotation);
sec.set("weight", weight);
sec.set("winner-rewards", winnerRewards);
sec.set("category", category.name());
if (region != null) {
sec.set("region.world", region.getWorldName());
@@ -146,6 +185,24 @@ public class EventDefinition {
sec.set("region.max-y", region.getMaxY());
sec.set("region.max-z", region.getMaxZ());
}
if (startRegion != null) {
sec.set("start-region.world", startRegion.getWorldName());
sec.set("start-region.min-x", startRegion.getMinX());
sec.set("start-region.min-y", startRegion.getMinY());
sec.set("start-region.min-z", startRegion.getMinZ());
sec.set("start-region.max-x", startRegion.getMaxX());
sec.set("start-region.max-y", startRegion.getMaxY());
sec.set("start-region.max-z", startRegion.getMaxZ());
}
if (goalRegion != null) {
sec.set("goal-region.world", goalRegion.getWorldName());
sec.set("goal-region.min-x", goalRegion.getMinX());
sec.set("goal-region.min-y", goalRegion.getMinY());
sec.set("goal-region.min-z", goalRegion.getMinZ());
sec.set("goal-region.max-x", goalRegion.getMaxX());
sec.set("goal-region.max-y", goalRegion.getMaxY());
sec.set("goal-region.max-z", goalRegion.getMaxZ());
}
if (!customSettings.isEmpty()) {
for (Map.Entry<String, Object> entry : customSettings.entrySet()) {
sec.set("settings." + entry.getKey(), entry.getValue());
@@ -174,6 +231,8 @@ public class EventDefinition {
public void setEndCommands(List<String> l) { this.endCommands = l; }
public List<String> getRewards() { return rewards; }
public void setRewards(List<String> l) { this.rewards = l; }
public List<String> getWinnerRewards() { return winnerRewards; }
public void setWinnerRewards(List<String> l) { this.winnerRewards = l; }
public String getAnnouncement() { return announcement; }
public void setAnnouncement(String a) { this.announcement = ColorUtil.color(a); }
public boolean isInRotation() { return inRotation; }
@@ -185,6 +244,12 @@ public class EventDefinition {
public EventRegion getRegion() { return region; }
public void setRegion(EventRegion r) { this.region = r; }
public boolean hasRegion() { return region != null; }
public EventRegion getStartRegion() { return startRegion; }
public void setStartRegion(EventRegion r) { this.startRegion = r; }
public boolean hasStartRegion() { return startRegion != null; }
public EventRegion getGoalRegion() { return goalRegion; }
public void setGoalRegion(EventRegion r) { this.goalRegion = r; }
public boolean hasGoalRegion() { return goalRegion != null; }
public Object getSetting(String key) { return customSettings.get(key); }
public void setSetting(String key, Object val) { customSettings.put(key, val); }
}