mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge branch 'development' into FS-24-Round-2
This commit is contained in:
commit
5b6d8b01a4
@ -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;
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -7,5 +7,6 @@ public enum PunishmentType
|
||||
KICK,
|
||||
TEMPBAN,
|
||||
BAN,
|
||||
DOOM
|
||||
DOOM,
|
||||
WARN
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user