SteamWar/BungeeCore
Archiviert
13
2

Push initial implementation
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2023-01-04 12:00:27 +01:00
Ursprung 59854ef3f0
Commit 1bec6c4cd4
4 geänderte Dateien mit 71 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -163,6 +163,8 @@ public class BungeeCore extends Plugin {
new CalendarCommand(); new CalendarCommand();
new CalendarListener(); new CalendarListener();
new ModCommand();
// Punishment Commands: // Punishment Commands:
new PunishmentCommand("ban", Punishment.PunishmentType.Ban); new PunishmentCommand("ban", Punishment.PunishmentType.Ban);
new PunishmentCommand("mute", Punishment.PunishmentType.Mute); new PunishmentCommand("mute", Punishment.PunishmentType.Mute);

Datei anzeigen

@ -0,0 +1,60 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.sql.Statement;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.UserGroup;
import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class ModCommand extends SWCommand {
private static final Statement set = new Statement("UPDATE Mods Set ModType = ? WHERE ModName = ?");
private static final Statement findFirst = new Statement("SELECT * FROM Mods WHERE modType = 0 LIMIT 1");
private static final Statement exists = new Statement("SELECT * FROM Mods WHERE ModName = ?");
public ModCommand() {
super("mod", "bungeecore.teamchat", "mods");
}
@Register(value = {"set"},description = "MOD_COMMAND_SET_USAGE")
public void set(ProxiedPlayer p,String modName,Integer newModType) {
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
UserGroup group = user.getUserGroup();
if(!group.isAdminGroup()) {
Message.send("MOD_COMMAND_SET_USAGE",p);
return;
}
set.update(newModType,modName);
Message.send("MOD_CHANGED_TYPE",p,modName,newModType);
}
@Register(value = {"next"},description = "MOD_COMMAND_NEXT_USAGE")
public void next(ProxiedPlayer p) {
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
UserGroup group = user.getUserGroup();
if(!group.isAdminGroup()) {
Message.send("MOD_COMMAND_NEXT_USAGE",p);
return;
}
String foundMod = findFirst.select(rs -> {
if(rs.next()) {
return rs.getString("ModName");
}
return null;
});
if(foundMod == null) {
Message.send("MOD_NO_MORE_UNCLASSIFIED_MODS",p);
return;
}
Message.send("MOD_FOUND_NEXT_MOD",p,foundMod);
}
}

Datei anzeigen

@ -28,11 +28,9 @@ import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.net.InetSocketAddress;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.Instant; import java.time.Instant;

Datei anzeigen

@ -656,3 +656,11 @@ ADVENT_CALENDAR_DAY=§7Day§8: §e{0}
ADVENT_CALENDAR_MESSAGE=§eDid you already open your advent calendar? ADVENT_CALENDAR_MESSAGE=§eDid you already open your advent calendar?
ADVENT_CALENDAR_MESSAGE_HOVER=§eClick to open! ADVENT_CALENDAR_MESSAGE_HOVER=§eClick to open!
ADVENT_CALENDAR_OPEN=§7You got §e{0} §7from the advent calendar! ADVENT_CALENDAR_OPEN=§7You got §e{0} §7from the advent calendar!
#Mod Command
MOD_COMMAND_SET_USAGE=§7/mod [mod name] [ModType 1-4]
MOD_COMMAND_NEXT_USAGE=§7/mod next
MOD_CHANGED_TYPE=§7Successfully reclassified mod {0} to type {1}!
MOD_NO_MORE_UNCLASSIFIED_MODS=§7No more unclassified mods found in databank!
MOD_FOUND_NEXT_MOD=§7Next unclassified mod is {0}!
MOD_COMMAND_NOT_FOUND_IN_DATABASE=§7The Mod {0} was§c not §7found in the database!