mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Ported all useful features from MobArena over to TFM
This commit is contained in:
parent
5c50069f21
commit
310ce4f75a
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Sat Aug 30 16:14:15 CEST 2014
|
#Sun Nov 02 13:49:36 CET 2014
|
||||||
build.number=949
|
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),
|
INFO("info", AdminLevel.SUPER, SourceType.BOTH, 2, 2),
|
||||||
ADD("add", AdminLevel.SUPER, SourceType.ONLY_CONSOLE, 2, 2),
|
ADD("add", AdminLevel.SUPER, SourceType.ONLY_CONSOLE, 2, 2),
|
||||||
DELETE("delete", AdminLevel.SENIOR, SourceType.ONLY_CONSOLE, 2, 2);
|
DELETE("delete", AdminLevel.SENIOR, SourceType.ONLY_CONSOLE, 2, 2);
|
||||||
|
|
||||||
private final String modeName;
|
private final String modeName;
|
||||||
private final AdminLevel adminLevel;
|
private final AdminLevel adminLevel;
|
||||||
private final SourceType sourceType;
|
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"
|
"schematic"
|
||||||
};
|
};
|
||||||
private static final String UPLOAD_FORM
|
private static final String UPLOAD_FORM = "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
||||||
= "<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"
|
+ "<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"
|
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
||||||
+ "<br />\n"
|
+ "<br />\n"
|
||||||
|
@ -8,6 +8,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -56,6 +57,7 @@ public class TFM_PlayerData
|
|||||||
private String lastCommand = "";
|
private String lastCommand = "";
|
||||||
private boolean cmdspyEnabled = false;
|
private boolean cmdspyEnabled = false;
|
||||||
private String tag = null;
|
private String tag = null;
|
||||||
|
private int warningCount = 0;
|
||||||
|
|
||||||
private TFM_PlayerData(Player player)
|
private TFM_PlayerData(Player player)
|
||||||
{
|
{
|
||||||
@ -503,4 +505,20 @@ public class TFM_PlayerData
|
|||||||
{
|
{
|
||||||
return this.tag;
|
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
|
public static class TFM_EntityWiper
|
||||||
{
|
{
|
||||||
private static final List<Class<? extends Entity>> WIPEABLES = new ArrayList<Class<? extends Entity>>();
|
private static final List<Class<? extends Entity>> WIPEABLES = new ArrayList<Class<? extends Entity>>();
|
||||||
|
Loading…
Reference in New Issue
Block a user