geforkt von SteamWar/BungeeCore
Merge pull request 'Allow HH:mm on /ban and /mute' (#132) from ban-time-update into master
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
746bf6db08
@ -38,7 +38,7 @@ public class BanCommand extends BasicCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(args.length < 3){
|
if(args.length < 3){
|
||||||
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder perma] [Grund]");
|
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,13 +63,19 @@ public class BanCommand extends BasicCommand {
|
|||||||
if(arg.equalsIgnoreCase("perma")) {
|
if(arg.equalsIgnoreCase("perma")) {
|
||||||
return Timestamp.from(Instant.ofEpochSecond(946674800));
|
return Timestamp.from(Instant.ofEpochSecond(946674800));
|
||||||
}else{
|
}else{
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH:mm");
|
||||||
try{
|
try{
|
||||||
Date parsedDate = dateFormat.parse(arg);
|
Date parsedDate = dateFormat.parse(arg);
|
||||||
return new java.sql.Timestamp(parsedDate.getTime());
|
return new java.sql.Timestamp(parsedDate.getTime());
|
||||||
}catch(ParseException e){
|
}catch(ParseException e){
|
||||||
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUngültige Zeitangabe.");
|
dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
return null;
|
try{
|
||||||
|
Date parsedDate = dateFormat.parse(arg.split("_")[0]);
|
||||||
|
return new java.sql.Timestamp(parsedDate.getTime());
|
||||||
|
}catch(ParseException exception){
|
||||||
|
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUngültige Zeitangabe.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class MuteCommand extends BasicCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(args.length < 3){
|
if(args.length < 3){
|
||||||
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder perma] [Grund]");
|
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren