mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added userlist
Build # tracking Exploding arrows
This commit is contained in:
parent
376f5a4edd
commit
ccd13369e5
@ -71,4 +71,13 @@
|
|||||||
nbproject/build-impl.xml file.
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<target name="-pre-jar">
|
||||||
|
<buildnumber file="buildnumber.properties" />
|
||||||
|
<propertyfile file="appinfo.properties">
|
||||||
|
<entry key="program.VERSION" default="2.5" />
|
||||||
|
<entry key="program.BUILDNUM" value="${build.number}" />
|
||||||
|
<entry key="program.BUILDDATE" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
|
||||||
|
</propertyfile>
|
||||||
|
<copy file="appinfo.properties" todir="${build.classes.dir}" />
|
||||||
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
X-COMMENT: Main-Class will be added automatically by build
|
|
||||||
|
|
@ -20,10 +20,10 @@ is divided into following sections:
|
|||||||
|
|
||||||
-->
|
-->
|
||||||
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="TotalFreedomMod-impl">
|
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="TotalFreedomMod-impl">
|
||||||
<fail message="Please build using Ant 1.7.1 or higher.">
|
<fail message="Please build using Ant 1.8.0 or higher.">
|
||||||
<condition>
|
<condition>
|
||||||
<not>
|
<not>
|
||||||
<antversion atleast="1.7.1"/>
|
<antversion atleast="1.8.0"/>
|
||||||
</not>
|
</not>
|
||||||
</condition>
|
</condition>
|
||||||
</fail>
|
</fail>
|
||||||
@ -198,6 +198,7 @@ is divided into following sections:
|
|||||||
<property name="javac.fork" value="${jdkBug6558476}"/>
|
<property name="javac.fork" value="${jdkBug6558476}"/>
|
||||||
<property name="jar.index" value="false"/>
|
<property name="jar.index" value="false"/>
|
||||||
<property name="jar.index.metainf" value="${jar.index}"/>
|
<property name="jar.index.metainf" value="${jar.index}"/>
|
||||||
|
<property name="copylibs.rebase" value="true"/>
|
||||||
<available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
|
<available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
|
||||||
</target>
|
</target>
|
||||||
<target name="-post-init">
|
<target name="-post-init">
|
||||||
@ -384,6 +385,7 @@ is divided into following sections:
|
|||||||
<property environment="env"/>
|
<property environment="env"/>
|
||||||
<resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
|
<resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
|
||||||
<java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
|
<java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
|
||||||
|
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||||
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
||||||
<jvmarg line="${profiler.info.jvmargs}"/>
|
<jvmarg line="${profiler.info.jvmargs}"/>
|
||||||
<env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
|
<env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
|
||||||
@ -514,7 +516,7 @@ is divided into following sections:
|
|||||||
</chainedmapper>
|
</chainedmapper>
|
||||||
</pathconvert>
|
</pathconvert>
|
||||||
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
|
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
|
||||||
<copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
|
<copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
|
||||||
<fileset dir="${build.classes.dir}"/>
|
<fileset dir="${build.classes.dir}"/>
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Class-Path" value="${jar.classpath}"/>
|
<attribute name="Class-Path" value="${jar.classpath}"/>
|
||||||
@ -839,6 +841,14 @@ is divided into following sections:
|
|||||||
-->
|
-->
|
||||||
<target depends="init" if="have.sources" name="-javadoc-build">
|
<target depends="init" if="have.sources" name="-javadoc-build">
|
||||||
<mkdir dir="${dist.javadoc.dir}"/>
|
<mkdir dir="${dist.javadoc.dir}"/>
|
||||||
|
<condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
|
||||||
|
<and>
|
||||||
|
<isset property="endorsed.classpath.cmd.line.arg"/>
|
||||||
|
<not>
|
||||||
|
<equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
|
||||||
|
</not>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
|
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
|
||||||
<classpath>
|
<classpath>
|
||||||
<path path="${javac.classpath}"/>
|
<path path="${javac.classpath}"/>
|
||||||
@ -850,6 +860,7 @@ is divided into following sections:
|
|||||||
<include name="**/*.java"/>
|
<include name="**/*.java"/>
|
||||||
<exclude name="*.java"/>
|
<exclude name="*.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
|
||||||
</javadoc>
|
</javadoc>
|
||||||
<copy todir="${dist.javadoc.dir}">
|
<copy todir="${dist.javadoc.dir}">
|
||||||
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
|
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
|
||||||
|
@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.44.1.45
|
|||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=7bf70ec5
|
nbproject/build-impl.xml.data.CRC32=7bf70ec5
|
||||||
nbproject/build-impl.xml.script.CRC32=c53303a0
|
nbproject/build-impl.xml.script.CRC32=ea1ae258
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
|
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.2.46
|
||||||
|
@ -51,7 +51,7 @@ public class Command_gadmin extends TFM_Command
|
|||||||
}
|
}
|
||||||
else if (mode.equals("ipban"))
|
else if (mode.equals("ipban"))
|
||||||
{
|
{
|
||||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
if (ip_parts.length == 4)
|
if (ip_parts.length == 4)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ public class Command_gadmin extends TFM_Command
|
|||||||
}
|
}
|
||||||
else if (mode.equals("ban"))
|
else if (mode.equals("ban"))
|
||||||
{
|
{
|
||||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
if (ip_parts.length == 4)
|
if (ip_parts.length == 4)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class Command_glist 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||||
|
{
|
||||||
|
String username;
|
||||||
|
List<String> ip_addresses = new ArrayList<String>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Player p = getPlayer(args[1]);
|
||||||
|
|
||||||
|
username = p.getName();
|
||||||
|
ip_addresses.add(p.getAddress().getAddress().getHostName());
|
||||||
|
}
|
||||||
|
catch (CantFindPlayerException ex)
|
||||||
|
{
|
||||||
|
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
|
||||||
|
|
||||||
|
if (entry == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
username = entry.getUsername();
|
||||||
|
ip_addresses = entry.getIpAddresses();
|
||||||
|
}
|
||||||
|
|
||||||
|
String mode = args[0].toLowerCase();
|
||||||
|
if (mode.equals("ban"))
|
||||||
|
{
|
||||||
|
Player p = server.getPlayerExact(username);
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
p.setBanned(true);
|
||||||
|
p.kickPlayer("IP and username banned by Administrator.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
server.getOfflinePlayer(username).setBanned(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String ip_address : ip_addresses)
|
||||||
|
{
|
||||||
|
server.banIP(ip_address);
|
||||||
|
String[] ip_address_parts = ip_address.split("\\.");
|
||||||
|
server.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mode.equals("unban"))
|
||||||
|
{
|
||||||
|
server.getOfflinePlayer(username).setBanned(false);
|
||||||
|
|
||||||
|
for (String ip_address : ip_addresses)
|
||||||
|
{
|
||||||
|
server.unbanIP(ip_address);
|
||||||
|
String[] ip_address_parts = ip_address.split("\\.");
|
||||||
|
server.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -64,7 +64,7 @@ public class Command_gtfo extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Ban IP Address:
|
//Ban IP Address:
|
||||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
if (ip_parts.length == 4)
|
if (ip_parts.length == 4)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ public class Command_saconfig extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
String user_name = p.getName().toLowerCase().trim();
|
String user_name = p.getName().toLowerCase().trim();
|
||||||
String new_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
String new_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
|
|
||||||
boolean something_changed = false;
|
boolean something_changed = false;
|
||||||
|
|
||||||
|
@ -18,9 +18,27 @@ public class Command_say extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String message = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
||||||
|
|
||||||
|
if (senderIsConsole && sender.getName().equals("Rcon"))
|
||||||
|
{
|
||||||
|
if (message.equals("WARNING: Server is restarting, you will be kicked"))
|
||||||
|
{
|
||||||
|
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
|
||||||
|
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
||||||
|
}
|
||||||
|
|
||||||
|
server.shutdown();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (senderIsConsole || sender.isOp())
|
if (senderIsConsole || sender.isOp())
|
||||||
{
|
{
|
||||||
String message = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
|
||||||
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,7 +12,15 @@ public class Command_status extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");
|
sender.sendMessage(ChatColor.GOLD + "Madgeek1450's Total Freedom Mod v" + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + ", built " + TotalFreedomMod.buildDate);
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Loaded worlds:");
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (World world : server.getWorlds())
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "World " + Integer.toString(i++) + ": " + world.getName() + " - " + Integer.toString(world.getPlayers().size()) + " players.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class TFM_EntityListener implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setYield(0.0f);
|
event.setYield(0.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
@ -138,4 +138,17 @@ public class TFM_EntityListener implements Listener
|
|||||||
event.setDroppedExp(0);
|
event.setDroppedExp(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void onProjectileHit(ProjectileHitEvent event)
|
||||||
|
{
|
||||||
|
if (TotalFreedomMod.allowExplosions)
|
||||||
|
{
|
||||||
|
Projectile entity = event.getEntity();
|
||||||
|
if (event.getEntityType() == EntityType.ARROW && entity.getShooter() instanceof Player)
|
||||||
|
{
|
||||||
|
entity.getWorld().createExplosion(entity.getLocation(), 2F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_LandmineData;
|
import me.StevenLawson.TotalFreedomMod.*;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import org.bukkit.*;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
@ -251,6 +244,8 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerChat(PlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
@ -268,22 +263,26 @@ public class TFM_PlayerListener implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pattern.compile("^mad(?:geek)?(?:1450)?[\\?\\.\\!]?$").matcher(event.getMessage().toLowerCase()).find())
|
// if (Pattern.compile("^mad(?:geek)?(?:1450)?[\\?\\.\\!]?$").matcher(event.getMessage().toLowerCase()).find())
|
||||||
{
|
// {
|
||||||
List<Player> matches = server.matchPlayer("Madgeek1450");
|
// if (server.getPlayerExact("Madgeek1450") != null)
|
||||||
if (!matches.isEmpty())
|
// {
|
||||||
{
|
// p.setGameMode(GameMode.SURVIVAL);
|
||||||
//TFM_Util.bcastMsg("<" + matches.get(0).getDisplayName() + "> Bitch says Madgeek...");
|
// p.setFoodLevel(0);
|
||||||
|
// p.setHealth(1);
|
||||||
|
//
|
||||||
|
// TNTPrimed tnt1 = p.getWorld().spawn(p.getLocation(), TNTPrimed.class);
|
||||||
|
// tnt1.setFuseTicks(40);
|
||||||
|
// tnt1.setPassenger(p);
|
||||||
|
// tnt1.setVelocity(new Vector(0.0, 2.0, 0.0));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
event.setMessage(ChatColor.stripColor(event.getMessage()));
|
||||||
p.setFoodLevel(0);
|
|
||||||
p.setHealth(1);
|
|
||||||
|
|
||||||
TNTPrimed tnt1 = p.getWorld().spawn(p.getLocation(), TNTPrimed.class);
|
|
||||||
tnt1.setFuseTicks(40);
|
|
||||||
tnt1.setPassenger(p);
|
|
||||||
tnt1.setVelocity(new Vector(0.0, 2.0, 0.0));
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,12 +418,14 @@ public class TFM_PlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
TFM_UserList.getInstance(plugin).addUser(event.getPlayer());
|
||||||
|
|
||||||
if (!server.getOnlineMode())
|
if (!server.getOnlineMode())
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if (TotalFreedomMod.superadmins.contains(p.getName().toLowerCase()))
|
if (TotalFreedomMod.superadmins.contains(p.getName().toLowerCase()))
|
||||||
{
|
{
|
||||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
if (user_ip != null && !user_ip.isEmpty())
|
if (user_ip != null && !user_ip.isEmpty())
|
||||||
{
|
{
|
||||||
TFM_Util.checkPartialSuperadminIP(user_ip, plugin);
|
TFM_Util.checkPartialSuperadminIP(user_ip, plugin);
|
||||||
|
@ -7,7 +7,10 @@ import java.util.Map;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class TFM_UserInfo
|
public class TFM_UserInfo
|
||||||
{
|
{
|
||||||
|
150
src/me/StevenLawson/TotalFreedomMod/TFM_UserList.java
Normal file
150
src/me/StevenLawson/TotalFreedomMod/TFM_UserList.java
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class TFM_UserList
|
||||||
|
{
|
||||||
|
private static final String USERLIST_FILENAME = "userlist.yml";
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
|
private static TFM_UserList instance = null;
|
||||||
|
|
||||||
|
private Map<String, TFM_UserListEntry> _userlist = new HashMap<String, TFM_UserListEntry>();
|
||||||
|
private final TotalFreedomMod _plugin;
|
||||||
|
|
||||||
|
protected TFM_UserList(TotalFreedomMod plugin)
|
||||||
|
{
|
||||||
|
_plugin = plugin;
|
||||||
|
|
||||||
|
primeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void primeList()
|
||||||
|
{
|
||||||
|
_userlist.clear();
|
||||||
|
|
||||||
|
FileConfiguration saved_userlist = YamlConfiguration.loadConfiguration(new File(_plugin.getDataFolder(), USERLIST_FILENAME));
|
||||||
|
|
||||||
|
for (String username : saved_userlist.getKeys(false))
|
||||||
|
{
|
||||||
|
TFM_UserListEntry entry = new TFM_UserListEntry(username, saved_userlist.getStringList(username));
|
||||||
|
_userlist.put(username, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player p : _plugin.getServer().getOnlinePlayers())
|
||||||
|
{
|
||||||
|
addUser(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
exportList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exportList()
|
||||||
|
{
|
||||||
|
FileConfiguration new_userlist = new YamlConfiguration();
|
||||||
|
|
||||||
|
for (TFM_UserListEntry entry : _userlist.values())
|
||||||
|
{
|
||||||
|
new_userlist.set(entry.getUsername(), entry.getIpAddresses());
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new_userlist.save(new File(_plugin.getDataFolder(), USERLIST_FILENAME));
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TFM_UserList getInstance(TotalFreedomMod plugin)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new TFM_UserList(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUser(Player p)
|
||||||
|
{
|
||||||
|
addUser(p.getName(), p.getAddress().getAddress().getHostAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUser(String username, String ip_address)
|
||||||
|
{
|
||||||
|
username = username.toLowerCase();
|
||||||
|
|
||||||
|
TFM_UserListEntry entry = _userlist.get(username);
|
||||||
|
if (entry == null)
|
||||||
|
{
|
||||||
|
entry = new TFM_UserListEntry(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
_userlist.put(username, entry);
|
||||||
|
|
||||||
|
if (entry.addIpAddress(ip_address))
|
||||||
|
{
|
||||||
|
exportList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TFM_UserListEntry getEntry(Player p)
|
||||||
|
{
|
||||||
|
return getEntry(p.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TFM_UserListEntry getEntry(String username)
|
||||||
|
{
|
||||||
|
return _userlist.get(username.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TFM_UserListEntry
|
||||||
|
{
|
||||||
|
private String _username;
|
||||||
|
private List<String> _ip_addresses = new ArrayList<String>();
|
||||||
|
|
||||||
|
public TFM_UserListEntry(String username, List<String>ip_addresses)
|
||||||
|
{
|
||||||
|
_username = username;
|
||||||
|
_ip_addresses = ip_addresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TFM_UserListEntry(String username)
|
||||||
|
{
|
||||||
|
_username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getIpAddresses()
|
||||||
|
{
|
||||||
|
return _ip_addresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername()
|
||||||
|
{
|
||||||
|
return _username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addIpAddress(String ip_address)
|
||||||
|
{
|
||||||
|
if (!_ip_addresses.contains(ip_address))
|
||||||
|
{
|
||||||
|
_ip_addresses.add(ip_address);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,35 +1,16 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.*;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.*;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.WorldType;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -225,7 +206,7 @@ public class TFM_Util
|
|||||||
tfm.getDataFolder().mkdirs();
|
tfm.getDataFolder().mkdirs();
|
||||||
output = new FileOutputStream(actual);
|
output = new FileOutputStream(actual);
|
||||||
byte[] buf = new byte[8192];
|
byte[] buf = new byte[8192];
|
||||||
int length = 0;
|
int length;
|
||||||
while ((length = input.read(buf)) > 0)
|
while ((length = input.read(buf)) > 0)
|
||||||
{
|
{
|
||||||
output.write(buf, 0, length);
|
output.write(buf, 0, length);
|
||||||
@ -554,7 +535,7 @@ public class TFM_Util
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
player_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
player_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
|
|
||||||
Integer num_kicks = TFM_Util.eject_tracker.get(player_ip);
|
Integer num_kicks = TFM_Util.eject_tracker.get(player_ip);
|
||||||
if (num_kicks == null)
|
if (num_kicks == null)
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
|
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.*;
|
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_WeatherListener;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -43,14 +43,18 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
|
setAppProperties();
|
||||||
|
|
||||||
loadMainConfig();
|
loadMainConfig();
|
||||||
loadSuperadminConfig();
|
loadSuperadminConfig();
|
||||||
|
|
||||||
|
TFM_UserList.getInstance(this);
|
||||||
|
|
||||||
registerEventHandlers();
|
registerEventHandlers();
|
||||||
|
|
||||||
server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||||
|
|
||||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Enabled! - Version: " + getDescription().getVersion() + " by Madgeek1450");
|
log.log(Level.INFO, "[" + getDescription().getName() + "] - Enabled! - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450");
|
||||||
|
|
||||||
TFM_Util.deleteFolder(new File("./_deleteme"));
|
TFM_Util.deleteFolder(new File("./_deleteme"));
|
||||||
|
|
||||||
@ -231,4 +235,29 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
pm.registerEvents(playerListener, this);
|
pm.registerEvents(playerListener, this);
|
||||||
pm.registerEvents(weatherListener, this);
|
pm.registerEvents(weatherListener, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String pluginVersion = "";
|
||||||
|
public static String buildNumber = "";
|
||||||
|
public static String buildDate = "";
|
||||||
|
|
||||||
|
private void setAppProperties()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
InputStream in;
|
||||||
|
Properties props = new Properties();
|
||||||
|
|
||||||
|
in = getClass().getResourceAsStream("/appinfo.properties");
|
||||||
|
props.load(in);
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
pluginVersion = props.getProperty("program.VERSION");
|
||||||
|
buildNumber = props.getProperty("program.BUILDNUM");
|
||||||
|
buildDate = props.getProperty("program.BUILDDATE");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: TotalFreedomMod
|
name: TotalFreedomMod
|
||||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||||
version: 2.4
|
version: 2.5
|
||||||
description: Plugin for the Total Freedom server.
|
description: Plugin for the Total Freedom server.
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
@ -58,6 +58,9 @@ commands:
|
|||||||
gcmd:
|
gcmd:
|
||||||
description: Superadmin command - Send a command as someone else.
|
description: Superadmin command - Send a command as someone else.
|
||||||
usage: /<command> <fromname> <outcommand>
|
usage: /<command> <fromname> <outcommand>
|
||||||
|
glist:
|
||||||
|
description: Superadmin command - Ban/Unban any player, even those who are not logged in anymore.
|
||||||
|
usage: /<command> <ban | unban> <username>
|
||||||
gtfo:
|
gtfo:
|
||||||
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
||||||
usage: /<command> <partialname>
|
usage: /<command> <partialname>
|
||||||
|
Loading…
Reference in New Issue
Block a user