mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 02:04:57 +00:00
Ported all useful features from MobArena over to TFM
This commit is contained in:
parent
5c50069f21
commit
310ce4f75a
7 changed files with 144 additions and 5 deletions
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Sat Aug 30 16:14:15 CEST 2014
|
||||
build.number=949
|
||||
#Sun Nov 02 13:49:36 CET 2014
|
||||
build.number=950
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
|
||||
@CommandParameters(description = "Report a player for admins to see.", usage = "/<command> <player> <reason>")
|
||||
public class Command_report extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
if (player.equals(sender_p))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "Please, don't try to report yourself.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "You can not report an admin.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
TFM_Util.reportAction(sender_p, player, report);
|
||||
|
||||
playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -194,7 +194,6 @@ public class Command_saconfig extends TFM_Command
|
|||
INFO("info", AdminLevel.SUPER, SourceType.BOTH, 2, 2),
|
||||
ADD("add", AdminLevel.SUPER, SourceType.ONLY_CONSOLE, 2, 2),
|
||||
DELETE("delete", AdminLevel.SENIOR, SourceType.ONLY_CONSOLE, 2, 2);
|
||||
|
||||
private final String modeName;
|
||||
private final AdminLevel adminLevel;
|
||||
private final SourceType sourceType;
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Warns a player.", usage = "/<command> <player> <reason>")
|
||||
public class Command_warn extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
if (player.equals(sender_p))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "Please, don't try to warn yourself.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "You can not warn admins");
|
||||
return true;
|
||||
}
|
||||
|
||||
String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
|
||||
playerMsg(ChatColor.RED + "[WARNING] " + warnReason);
|
||||
playerMsg(ChatColor.GREEN + "You have successfully warned " + player.getName());
|
||||
|
||||
TFM_PlayerData.getPlayerData(player).incrementWarnings();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -27,8 +27,7 @@ public class Module_schematic extends TFM_HTTPD_Module
|
|||
{
|
||||
"schematic"
|
||||
};
|
||||
private static final String UPLOAD_FORM
|
||||
= "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
||||
private static final String UPLOAD_FORM = "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
||||
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
|
||||
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
||||
+ "<br />\n"
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
|
@ -56,6 +57,7 @@ public class TFM_PlayerData
|
|||
private String lastCommand = "";
|
||||
private boolean cmdspyEnabled = false;
|
||||
private String tag = null;
|
||||
private int warningCount = 0;
|
||||
|
||||
private TFM_PlayerData(Player player)
|
||||
{
|
||||
|
@ -503,4 +505,20 @@ public class TFM_PlayerData
|
|||
{
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
public int getWarningCount()
|
||||
{
|
||||
return this.warningCount;
|
||||
}
|
||||
|
||||
public void incrementWarnings()
|
||||
{
|
||||
this.warningCount++;
|
||||
|
||||
if (this.warningCount % 2 == 0)
|
||||
{
|
||||
this.player.getWorld().strikeLightning(this.player.getLocation());
|
||||
TFM_Util.playerMsg(this.player, ChatColor.RED + "You have been warned at least twice now, make sure to read the rules at " + TFM_ConfigEntry.SERVER_BAN_URL.getString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -983,6 +983,17 @@ public class TFM_Util
|
|||
|
||||
}
|
||||
|
||||
public static void reportAction(Player reporter, Player reported, String report)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player, ChatColor.RED + "[REPORTS] " + ChatColor.GOLD + reporter.getName() + " has reported " + reported.getName() + " for " + report);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TFM_EntityWiper
|
||||
{
|
||||
private static final List<Class<? extends Entity>> WIPEABLES = new ArrayList<Class<? extends Entity>>();
|
||||
|
|
Loading…
Reference in a new issue