mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge branch 'master' into pr/571
This commit is contained in:
commit
edaaeef65f
@ -2,6 +2,6 @@
|
||||
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
||||
|
||||
This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van der Sar (DarthSalamon) becoming heavily involved in its development some time later. It consists of over 85 custom coded commands and a large variety of distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together, with the main TotalFreedom server, TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a clear feeling of openness towards the administrators and the players themselves.
|
||||
This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van der Sar (Prozza) becoming heavily involved in its development some time later. It consists of over 85 custom coded commands and a large variety of distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together, with the main TotalFreedom server, TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a clear feeling of openness towards the administrators and the players themselves.
|
||||
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod. For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Mon Feb 16 16:40:10 CET 2015
|
||||
build.number=982
|
||||
#Sun Apr 26 22:23:22 CEST 2015
|
||||
build.number=990
|
||||
|
@ -48,17 +48,17 @@ jar.archive.disabled=${jnlp.enabled}
|
||||
jar.compress=false
|
||||
jar.index=${jnlp.enabled}
|
||||
javac.classpath=\
|
||||
${libs.WorldEdit.classpath}:\
|
||||
${libs.Essentials.classpath}:\
|
||||
${libs.SpigotServer.classpath}:\
|
||||
${libs.BukkitTelnet.classpath}:\
|
||||
${libs.SpigotServer.classpath}
|
||||
${libs.TF-WorldEdit.classpath}:\
|
||||
${libs.Essentials.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.source=1.7
|
||||
javac.target=1.7
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
|
||||
ips:
|
||||
- '192.168.1.254:Notch:DarthSalamon:0:IP ban example'
|
||||
- '192.168.1.254:Notch:Prozza:0:IP ban example'
|
||||
|
||||
uuids:
|
||||
- '245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:DarthSalamon:0:UUID ban example'
|
||||
- '245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:Prozza:0:UUID ban example'
|
@ -275,7 +275,7 @@ unbannable_usernames:
|
||||
|
||||
# IPs that can not be supered
|
||||
noadmin_ips:
|
||||
- 127.0.0.1
|
||||
- 167.114.97.16
|
||||
|
||||
# TwitterBot - Used to allow superadmins to verify themselves using twitter
|
||||
twitterbot:
|
||||
|
@ -1,11 +1,10 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
@ -15,7 +14,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class TFM_TelnetListener implements Listener
|
||||
public class TFM_BukkitTelnetListener implements Listener
|
||||
{
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onTelnetPreLogin(TelnetPreLoginEvent event)
|
@ -1,20 +1,12 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class TFM_WorldEditBridge
|
||||
{
|
||||
@ -25,7 +17,7 @@ public class TFM_WorldEditBridge
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static WorldEditPlugin getWorldEditPlugin()
|
||||
private static WorldEditPlugin getWorldEditPlugin()
|
||||
{
|
||||
if (worldEditPlugin == null)
|
||||
{
|
||||
@ -48,14 +40,14 @@ public class TFM_WorldEditBridge
|
||||
return worldEditPlugin;
|
||||
}
|
||||
|
||||
public static BukkitPlayer getBukkitPlayer(Player player)
|
||||
private static LocalSession getPlayerSession(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
final WorldEditPlugin wep = getWorldEditPlugin();
|
||||
if (wep != null)
|
||||
{
|
||||
return wep.wrapPlayer(player);
|
||||
return wep.getSession(player);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -65,14 +57,14 @@ public class TFM_WorldEditBridge
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LocalSession getPlayerSession(Player player)
|
||||
private static BukkitPlayer getBukkitPlayer(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
final WorldEditPlugin wep = getWorldEditPlugin();
|
||||
if (wep != null)
|
||||
{
|
||||
return wep.getSession(player);
|
||||
return wep.wrapPlayer(player);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -120,54 +112,4 @@ public class TFM_WorldEditBridge
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateSelection(final Player player)
|
||||
{
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final LocalSession session = getPlayerSession(player);
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final World selectionWorld = session.getSelectionWorld();
|
||||
final Region selection = session.getSelection(selectionWorld);
|
||||
|
||||
if (TFM_ProtectedArea.isInProtectedArea(
|
||||
getBukkitVector(selection.getMinimumPoint()),
|
||||
getBukkitVector(selection.getMaximumPoint()),
|
||||
selectionWorld.getName()))
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared.");
|
||||
session.getRegionSelector(selectionWorld).clear();
|
||||
}
|
||||
}.runTask(TotalFreedomMod.plugin);
|
||||
}
|
||||
|
||||
}
|
||||
catch (IncompleteRegionException ex)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static org.bukkit.util.Vector getBukkitVector(com.sk89q.worldedit.Vector worldEditVector)
|
||||
{
|
||||
return new org.bukkit.util.Vector(worldEditVector.getX(), worldEditVector.getY(), worldEditVector.getZ());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.worldedit.LimitChangedEvent;
|
||||
import me.StevenLawson.worldedit.SelectionChangedEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class TFM_WorldEditListener implements Listener
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
public void onSelectionChange(final SelectionChangedEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TFM_ProtectedArea.isInProtectedArea(
|
||||
event.getMinVector(),
|
||||
event.getMaxVector(),
|
||||
event.getWorld().getName()))
|
||||
{
|
||||
|
||||
player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLimitChanged(LimitChangedEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getPlayer().equals(event.getTarget()))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Only admins can change the limit for other players!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (event.getLimit() < 0 || event.getLimit() > 10000)
|
||||
{
|
||||
player.setOp(false);
|
||||
TFM_Util.bcastMsg(event.getPlayer().getName() + " tried to set their WorldEdit limit to " + event.getLimit() + " and has been de-opped", ChatColor.RED);
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + "You cannot set your limit higher than 10000 or to -1!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -13,10 +13,10 @@ public class Command_setl extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 500.", true);
|
||||
TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 2500.", true);
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_WorldEditBridge.setLimit(player, 500);
|
||||
TFM_WorldEditBridge.setLimit(player, 2500);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class TFM_Config extends YamlConfiguration // BukkitLib @ https://github.
|
||||
*
|
||||
* <p>Example:
|
||||
* <pre>
|
||||
* YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "DarthSalamon.yml"), false);
|
||||
* YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "Prozza.yml"), false);
|
||||
* config.load();
|
||||
* </pre></p>
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@ -24,6 +25,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_AdminList
|
||||
{
|
||||
public static final Function<Player, Boolean> SUPERADMIN_SERVICE;
|
||||
private static final Map<UUID, TFM_Admin> adminList;
|
||||
private static final Set<UUID> superUUIDs;
|
||||
private static final Set<UUID> telnetUUIDs;
|
||||
@ -40,6 +42,15 @@ public class TFM_AdminList
|
||||
seniorUUIDs = new HashSet<UUID>();
|
||||
seniorConsoleNames = new HashSet<String>();
|
||||
superIps = new HashSet<String>();
|
||||
|
||||
SUPERADMIN_SERVICE = new Function<Player, Boolean>() {
|
||||
|
||||
@Override
|
||||
public Boolean apply(Player f)
|
||||
{
|
||||
return isSuperAdmin(f);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private TFM_AdminList()
|
||||
|
@ -16,7 +16,7 @@ public class TFM_Ban
|
||||
|
||||
static
|
||||
{
|
||||
// 192.168.1.254:LocalHost:DarthSalamon:0:none
|
||||
// 192.168.1.254:LocalHost:Prozza:0:none
|
||||
// 127.0.*.*:TestUserName:BannedByNotch:123567:Test reason
|
||||
IP_BAN_REGEX = Pattern.compile(
|
||||
"^((?:(?:\\*|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\\.){3}(?:\\*|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))"
|
||||
@ -24,7 +24,7 @@ public class TFM_Ban
|
||||
+ ":([\\w]+)"
|
||||
+ ":(\\d+)"
|
||||
+ ":([\\s\\S]+)$");
|
||||
// 245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:DarthSalamon:0:Example reason
|
||||
// 245d2f30-61fb-4840-9cd3-298b3920f4a4:Cobrex:Prozza:0:Example reason
|
||||
UUID_BAN_REGEX = Pattern.compile(
|
||||
"^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"
|
||||
+ ":([\\w\\s]+)"
|
||||
|
@ -5,8 +5,9 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import net.minecraft.server.v1_8_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R1.PropertyManager;
|
||||
import net.minecraft.server.v1_8_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R2.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R2.PropertyManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,7 +16,7 @@ import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
|
||||
public class TFM_ServerInterface
|
||||
{
|
||||
public static final String COMPILE_NMS_VERSION = "v1_8_R1";
|
||||
public static final String COMPILE_NMS_VERSION = "v1_8_R2";
|
||||
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
||||
|
||||
public static void setOnlineMode(boolean mode)
|
||||
@ -29,9 +30,8 @@ public class TFM_ServerInterface
|
||||
{
|
||||
String[] whitelisted = MinecraftServer.getServer().getPlayerList().getWhitelisted();
|
||||
int size = whitelisted.length;
|
||||
for (String player : MinecraftServer.getServer().getPlayerList().getWhitelist().getEntries())
|
||||
{
|
||||
MinecraftServer.getServer().getPlayerList().getWhitelist().remove(player);
|
||||
for (EntityPlayer player : MinecraftServer.getServer().getPlayerList().players) {
|
||||
MinecraftServer.getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
||||
}
|
||||
|
||||
try
|
||||
@ -48,7 +48,7 @@ public class TFM_ServerInterface
|
||||
|
||||
public static boolean isWhitelisted()
|
||||
{
|
||||
return MinecraftServer.getServer().getPlayerList().hasWhitelist;
|
||||
return MinecraftServer.getServer().getPlayerList().getHasWhitelist();
|
||||
}
|
||||
|
||||
public static List<?> getWhitelisted()
|
||||
|
@ -326,7 +326,7 @@ public class TFM_Util
|
||||
block.setType(Material.SKULL);
|
||||
final Skull skull = (Skull) block.getState();
|
||||
skull.setSkullType(SkullType.PLAYER);
|
||||
skull.setOwner("DarthSalamon");
|
||||
skull.setOwner("Prozza");
|
||||
skull.update();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -7,6 +8,8 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_BukkitTelnetListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
@ -15,7 +18,6 @@ import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_ServerListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_TelnetListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
|
||||
@ -25,6 +27,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.mcstats.Metrics;
|
||||
@ -74,7 +77,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
TFM_Log.info("Made by Madgeek1450 and DarthSalamon");
|
||||
TFM_Log.info("Made by Madgeek1450 and Prozza");
|
||||
TFM_Log.info("Compiled " + buildDate + " by " + buildCreator);
|
||||
|
||||
final TFM_Util.MethodTimer timer = new TFM_Util.MethodTimer();
|
||||
@ -111,13 +114,19 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_ProtectedArea.autoAddSpawnpoints();
|
||||
}
|
||||
|
||||
// Start SuperAdmin service
|
||||
server.getServicesManager().register(Function.class, TFM_AdminList.SUPERADMIN_SERVICE, plugin, ServicePriority.Normal);
|
||||
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
pm.registerEvents(new TFM_EntityListener(), plugin);
|
||||
pm.registerEvents(new TFM_BlockListener(), plugin);
|
||||
pm.registerEvents(new TFM_PlayerListener(), plugin);
|
||||
pm.registerEvents(new TFM_WeatherListener(), plugin);
|
||||
pm.registerEvents(new TFM_ServerListener(), plugin);
|
||||
pm.registerEvents(new TFM_TelnetListener(), plugin);
|
||||
|
||||
// Bridge
|
||||
pm.registerEvents(new TFM_BukkitTelnetListener(), plugin);
|
||||
pm.registerEvents(new TFM_WorldEditListener(), plugin);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -5,8 +5,8 @@
|
||||
clean_threshold_hours: 168
|
||||
|
||||
admins:
|
||||
b3c3b05a-a52d-33a6-a9c6-6e5063e00f0a:
|
||||
last_login_name: DarthSalamon
|
||||
f9a1982e-252e-4ed3-92ed-52b0506a39c9:
|
||||
last_login_name: Prozza
|
||||
is_activated: true
|
||||
is_senior_admin: true
|
||||
is_telnet_admin: true
|
||||
|
Loading…
Reference in New Issue
Block a user