Merge branch 'development' into FS-24-Round-2

This commit is contained in:
Video 2021-06-17 05:25:42 -06:00 committed by GitHub
commit 5b6d8b01a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 17 deletions

View file

@ -1,6 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
@ -53,25 +56,28 @@ public class Command_warn extends FreedomCommand
String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
player.sendTitle(ChatColor.RED + "You've been warned.", ChatColor.YELLOW + "Reason: " + warnReason, 20, 100, 60);
msg(ChatColor.GREEN + "You have successfully warned " + player.getName());
msg(player, ChatColor.RED + "[WARNING] You received a warning from " + sender.getName() + ": " + warnReason);
plugin.pl.getPlayer(player).incrementWarnings(quiet);
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.WARN, warnReason));
if (quiet)
{
msg("Warned " + player.getName() + " quietly");
return true;
msg("You have successfully warned " + player.getName() + " quietly.");
}
else
{
String adminNotice = ChatColor.RED +
sender.getName() +
" - " +
"Warning: " +
player.getName() +
" - Reason: " +
ChatColor.YELLOW +
warnReason;
plugin.al.messageAllAdmins(adminNotice);
msg(player, ChatColor.RED + "[WARNING] You received a warning from " + sender.getName() + ": " + warnReason);
String adminNotice = ChatColor.RED +
sender.getName() +
" - " +
"Warning: " +
player.getName() +
" - Reason: " +
ChatColor.YELLOW +
warnReason;
plugin.al.messageAllAdmins(adminNotice);
plugin.pl.getPlayer(player).incrementWarnings();
msg("You have successfully warned " + player.getName() + ".");
}
return true;
}
}

View file

@ -429,14 +429,19 @@ public class FPlayer
this.warningCount = warningCount;
}
public void incrementWarnings()
public void incrementWarnings(boolean quiet)
{
this.warningCount++;
if (this.warningCount % 2 == 0)
{
Player p = getPlayer();
p.getWorld().strikeLightning(p.getLocation());
if (!quiet)
{
p.getWorld().strikeLightning(p.getLocation());
}
FUtil.playerMsg(p, ChatColor.RED + "You have been warned at least twice now, make sure to read the rules at " + ConfigEntry.SERVER_BAN_URL.getString());
}
}

View file

@ -7,5 +7,6 @@ public enum PunishmentType
KICK,
TEMPBAN,
BAN,
DOOM
DOOM,
WARN
}