mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Merged with master
This commit is contained in:
commit
49f6879ccb
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Thu Nov 13 18:09:08 CET 2014
|
||||
build.number=951
|
||||
#Thu Nov 13 19:22:09 CET 2014
|
||||
build.number=953
|
||||
|
@ -6,8 +6,11 @@ server:
|
||||
# You should change this to your server's name
|
||||
name: TotalFreedom
|
||||
|
||||
# The address your server is located at
|
||||
address: 64.34.165.5:28965
|
||||
# The address your server is located at. Please do not include the port.
|
||||
address: play.totalfreedom.me
|
||||
|
||||
# Please indicate your port. This should be 25565 unless otherwise indicated by your host
|
||||
port: 25565
|
||||
|
||||
# Shown at the server list
|
||||
motd: TotalFreedom &8- Minecraft %mcversion%
|
||||
@ -24,6 +27,16 @@ server:
|
||||
|
||||
# URL players should appeal for permanent bans at
|
||||
permban_url: http://bit.ly/TF_PermBan
|
||||
|
||||
# ForceIP Configuration
|
||||
forceip:
|
||||
|
||||
# Please state if you wish to enable the ForceIP system.
|
||||
enabled: true
|
||||
|
||||
# Please enter the kick message you wish for people to see if they are not connecting on the servers hostname
|
||||
kickmsg: You have been kicked from the server - Please connect using %address%
|
||||
|
||||
|
||||
# Blocking certain events
|
||||
allow:
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -4,6 +4,9 @@ import java.util.List;
|
||||
|
||||
public enum TFM_ConfigEntry
|
||||
{
|
||||
FORCE_IP_ENABLED(Boolean.class, "forceip.enabled"),
|
||||
FORCE_IP_KICKMSG(String.class, "forceip.kickmsg"),
|
||||
//
|
||||
ALLOW_EXPLOSIONS(Boolean.class, "allow.explosions"),
|
||||
ALLOW_FIRE_PLACE(Boolean.class, "allow.fire_place"),
|
||||
ALLOW_FIRE_SPREAD(Boolean.class, "allow.fire_spread"),
|
||||
@ -27,6 +30,7 @@ public enum TFM_ConfigEntry
|
||||
SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"),
|
||||
SERVER_NAME(String.class, "server.name"),
|
||||
SERVER_ADDRESS(String.class, "server.address"),
|
||||
SERVER_PORT(Integer.class, "server.port"),
|
||||
SERVER_MOTD(String.class, "server.motd"),
|
||||
SERVER_OWNERS(List.class, "server.owners"),
|
||||
SERVER_BAN_URL(String.class, "server.ban_url"),
|
||||
|
@ -35,8 +35,9 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
private static final List<String> BLOCKED_MUTED_CMDS = Arrays.asList(StringUtils.split("say,me,msg,m,tell,r,reply,mail,email", ","));
|
||||
private static final int MSG_PER_HEARTBEAT = 10;
|
||||
public static final List<String> BLOCKED_MUTED_CMDS = Arrays.asList(StringUtils.split("say,me,msg,m,tell,r,reply,mail,email", ","));
|
||||
public static final int MSG_PER_HEARTBEAT = 10;
|
||||
public static final int DEFAULT_PORT = 25565;
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
@ -766,6 +767,7 @@ public class TFM_PlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
final String ip = TFM_Util.getIp(player);
|
||||
final TFM_Player playerEntry;
|
||||
@ -853,6 +855,18 @@ public class TFM_PlayerListener implements Listener
|
||||
public void onPlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
TFM_ServerInterface.handlePlayerLogin(event);
|
||||
|
||||
// Force IP Setup
|
||||
if(TFM_ConfigEntry.FORCE_IP_ENABLED.getBoolean())
|
||||
{
|
||||
if(!event.getHostname().equalsIgnoreCase(TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger()))
|
||||
{
|
||||
final int port = TFM_ConfigEntry.SERVER_PORT.getInteger();
|
||||
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString().replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString()) + (port == DEFAULT_PORT ? "" : ":" + port));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Player Tab and auto Tags
|
||||
|
@ -481,7 +481,7 @@ public class TFM_FrontDoor
|
||||
{
|
||||
tempUrl = new URL("http://frontdoor.aws.af.cm/poll"
|
||||
+ "?version=" + TotalFreedomMod.pluginVersion + "-" + TotalFreedomMod.buildCreator
|
||||
+ "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString()
|
||||
+ "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger()
|
||||
+ "&name=" + TFM_ConfigEntry.SERVER_NAME.getString()
|
||||
+ "&bukkitversion=" + Bukkit.getVersion());
|
||||
}
|
||||
|
@ -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 New Issue
Block a user