Upload folder via GUI - src

This commit is contained in:
Git Manager GUI
2026-04-29 19:14:58 +02:00
parent d1618d45c8
commit 6df2548399

View File

@@ -957,11 +957,23 @@ public class IngameShopSpigot extends JavaPlugin implements Listener {
anyCode = true;
} else if ("fly_abo".equals(type)) {
// Fly-Abo: monatliche Abbuchung, Preis des Shop-Artikels = Monatsbeitrag
// Fly-Abo: monatliche Abbuchung
String label = cmdObj.has("label")
? cmdObj.get("label").getAsString() : "Fly-Abo";
int monthlyPrice = (int) data.price;
flyAboManager.grantAbo(player, label, monthlyPrice);
int monthlyPrice = cmdObj.has("price") && cmdObj.get("price").getAsInt() > 0
? cmdObj.get("price").getAsInt()
: (int) data.price;
// Sicherer Spielername: getName() kann bei CMI leer sein → UUID-Lookup
String safeName = player.getName();
if (safeName == null || safeName.isEmpty()) {
org.bukkit.OfflinePlayer op = Bukkit.getOfflinePlayer(player.getUniqueId());
safeName = op.getName() != null ? op.getName() : player.getUniqueId().toString();
}
final String finalName = safeName;
getLogger().info("[FlyAbo] Abo aktiviert für " + finalName + " " + label);
flyAboManager.grantAboByName(finalName, label, monthlyPrice);
// Ingame-Nachricht direkt an den Spieler
flyAboManager.notifyGranted(player, label, monthlyPrice);
anyCode = true;
} else if ("plot_slots".equals(type)) {
@@ -2599,8 +2611,15 @@ public class IngameShopSpigot extends JavaPlugin implements Listener {
String[] migrations = {
"ALTER TABLE wis_fly_abos ADD COLUMN IF NOT EXISTS monthly_price INT NOT NULL DEFAULT 0 AFTER label",
"ALTER TABLE wis_fly_abos ADD COLUMN IF NOT EXISTS cancellation_reason VARCHAR(32) DEFAULT NULL AFTER cancelled",
// expires_at Spalte entfernen falls vorhanden (altes Schema verhindert INSERT)
"ALTER TABLE wis_fly_abos DROP COLUMN IF EXISTS expires_at",
"ALTER TABLE wis_fly_abos ADD COLUMN IF NOT EXISTS next_billing_date DATE NOT NULL DEFAULT (CURDATE()) AFTER cancellation_reason",
"ALTER TABLE wis_fly_abos ADD COLUMN IF NOT EXISTS period_end DATE NOT NULL DEFAULT (LAST_DAY(CURDATE())) AFTER next_billing_date",
// Alte Einträge mit period_end = 0000-00-00 reparieren
"UPDATE wis_fly_abos SET"
+ " period_end = LAST_DAY(CURDATE()),"
+ " next_billing_date = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')"
+ " WHERE period_end = '0000-00-00' OR period_end IS NULL OR period_end < '2020-01-01'",
};
String sqlUsage =
"CREATE TABLE IF NOT EXISTS wis_fly_abo_usage ("
@@ -3694,6 +3713,22 @@ public class IngameShopSpigot extends JavaPlugin implements Listener {
db.saveAbo(playerName, label, monthlyPrice);
}
void notifyGranted(Player player, String label, int monthlyPrice) {
Bukkit.getScheduler().runTask(plugin, () -> {
player.sendMessage("");
player.sendMessage(ChatColor.GOLD + "✈ ════════════════════════════");
player.sendMessage(ChatColor.YELLOW + " Fly-Abo aktiviert!");
player.sendMessage(ChatColor.GRAY + " Paket: " + ChatColor.WHITE + label);
player.sendMessage(ChatColor.GRAY + " Monatspreis: " + ChatColor.WHITE + monthlyPrice + " " + currency);
player.sendMessage(ChatColor.GRAY + " Tägl. Limit: " + ChatColor.WHITE
+ flyManager.formatTime(flyAboMaxDailySec));
player.sendMessage(ChatColor.GRAY + " Status: " + ChatColor.WHITE + "/flyabo");
player.sendMessage(ChatColor.GOLD + " ════════════════════════════");
player.sendMessage("");
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.2F);
});
}
// ── Kündigung durch Spieler ────────────────────────────────────
boolean cancelAbo(String playerName) {