mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-28 20:47:37 +00:00
Added checkstyle plugin
Moved resources to correct folder Fixed and improved build information, no longer tracking build.properties
This commit is contained in:
parent
89a317b7df
commit
a0058869c9
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,12 +1,14 @@
|
||||
# TFM excludes
|
||||
/lib
|
||||
build.properties
|
||||
|
||||
# Netbeans excludes
|
||||
/nbproject/private
|
||||
/dist
|
||||
/build
|
||||
manifest.mf
|
||||
nb-configuration.xml
|
||||
# Now defines that Maven CheckStyle is used
|
||||
# nb-configuration.xml
|
||||
|
||||
# Eclipse excludes
|
||||
.project
|
||||
|
@ -1,4 +0,0 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Wed Nov 18 21:37:05 CET 2015
|
||||
buildAuthor=ProzzaGuy
|
||||
buildNumber=13
|
133
checkstyle.xml
Normal file
133
checkstyle.xml
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
|
||||
<module name="Checker">
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="supressions.xml" />
|
||||
</module>
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="IllegalTokenText">
|
||||
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||
<property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max" value="200"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="NoLineWrap"/>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="LeftCurly">
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
<property name="allowEmptyLoops" value="true"/>
|
||||
<message key="ws.notFollowed"
|
||||
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
|
||||
<message key="ws.notPreceded"
|
||||
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="OneStatementPerLine"/>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="FallThrough"/>
|
||||
<module name="UpperEll"/>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="tokens" value="DOT"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="tokens" value="COMMA"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="PackageName">
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="TypeName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|(^[A-Z][_a-zA-Z0-9]*$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LocalVariableName">
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
|
||||
<property name="allowOneCharVarInForLoop" value="true"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MethodTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="NoFinalizer"/>
|
||||
<module name="GenericWhitespace">
|
||||
<message key="ws.followed"
|
||||
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||
<message key="ws.preceded"
|
||||
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||
<message key="ws.illegalFollow"
|
||||
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||
<message key="ws.notPreceded"
|
||||
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="OverloadMethodsDeclarationOrder"/>
|
||||
<module name="CustomImportOrder"/><!-- http://checkstyle.sourceforge.net/config_imports.html -->
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="OperatorWrap">
|
||||
<property name="option" value="NL"/>
|
||||
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="CommentsIndentation"/>
|
||||
</module>
|
||||
</module>
|
18
nb-configuration.xml
Normal file
18
nb-configuration.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<netbeans.checkstyle.format>true</netbeans.checkstyle.format>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
59
pom.xml
59
pom.xml
@ -13,6 +13,8 @@
|
||||
<tfm.build.number>${maven.buildnumber}</tfm.build.number>
|
||||
<tfm.build.date>${maven.build.timestamp}</tfm.build.date>
|
||||
<tfm.build.author>${buildAuthor}</tfm.build.author>
|
||||
<tfm.build.head>${buildHead}</tfm.build.head>
|
||||
<jar.finalName>${project.name}</jar.finalName>
|
||||
<maven.build.timestamp.format>dd/MM/yyyy hh:mm aa</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
@ -145,30 +147,40 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Checkstyle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>2.17</version>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failsOnError>true</failsOnError>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Compiler -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<outputFileName>TotalFreedomMod.jar</outputFileName>
|
||||
<compilerVersion>1.7</compilerVersion>
|
||||
<source>1.6</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Git describe -->
|
||||
<plugin>
|
||||
<groupId>com.lukegb.mojo</groupId>
|
||||
@ -182,6 +194,7 @@
|
||||
<goal>gitdescribe</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptionProperty>buildHead</descriptionProperty>
|
||||
<extraArguments>
|
||||
<param>--tags</param>
|
||||
<param>--always</param>
|
||||
@ -218,4 +231,26 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<reporting>
|
||||
<!-- Checkstyle -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>2.17</version>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<failsOnError>true</failsOnError>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
@ -11,6 +11,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Announcer extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
private final List<String> announcements = Lists.newArrayList();
|
||||
@Getter
|
||||
private boolean enabled;
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class AntiNuke extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public AntiNuke(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class EntityWiper extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
private static final long WIPE_RATE = 5 * 20L;
|
||||
//
|
||||
private final List<Class<? extends Entity>> wipables = new ArrayList<Class<? extends Entity>>();
|
||||
|
@ -61,6 +61,7 @@ import org.bukkit.util.Vector;
|
||||
*/
|
||||
public class FrontDoor extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
private static final long UPDATER_INTERVAL = 180L * 20L;
|
||||
private static final long FRONTDOOR_INTERVAL = 900L * 20L;
|
||||
//
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class Fuckoff extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public Fuckoff(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.World;
|
||||
|
||||
public class GameRuleHandler extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
private final EnumMap<TFM_GameRule, TFM_GameRule_Value> rules = new EnumMap<TFM_GameRule, TFM_GameRule_Value>(TFM_GameRule.class);
|
||||
|
||||
public GameRuleHandler(TotalFreedomMod plugin)
|
||||
@ -78,6 +79,7 @@ public class GameRuleHandler extends AbstractService<TotalFreedomMod>
|
||||
|
||||
public static enum TFM_GameRule
|
||||
{
|
||||
|
||||
DO_FIRE_TICK("doFireTick", TFM_GameRule_Value.TRUE),
|
||||
MOB_GRIEFING("mobGriefing", TFM_GameRule_Value.TRUE),
|
||||
KEEP_INVENTORY("keepInventory", TFM_GameRule_Value.FALSE),
|
||||
@ -109,6 +111,7 @@ public class GameRuleHandler extends AbstractService<TotalFreedomMod>
|
||||
|
||||
public static enum TFM_GameRule_Value
|
||||
{
|
||||
|
||||
TRUE("true"), FALSE("false");
|
||||
private final String value;
|
||||
|
||||
@ -133,4 +136,5 @@ public class GameRuleHandler extends AbstractService<TotalFreedomMod>
|
||||
return (in ? TFM_GameRule_Value.TRUE : TFM_GameRule_Value.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class LoginProcess extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public static final int DEFAULT_PORT = 25565;
|
||||
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
||||
|
||||
|
@ -18,8 +18,9 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
public class Muter extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
// TODO: Match actual commands
|
||||
public final List<String> MUTE_COMMANDS = Arrays.asList(StringUtils.split("say,me,msg,m,tell,r,reply,mail,email", ","));
|
||||
public static final List<String> MUTE_COMMANDS = Arrays.asList(StringUtils.split("say,me,msg,m,tell,r,reply,mail,email", ","));
|
||||
|
||||
public Muter(TotalFreedomMod plugin)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class ProtectArea extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public static final double MAX_RADIUS = 50.0;
|
||||
//
|
||||
private final Map<String, SerializableProtectedRegion> areas = Maps.newHashMap();
|
||||
@ -335,6 +336,7 @@ public class ProtectArea extends AbstractService<TotalFreedomMod>
|
||||
|
||||
public static class SerializableProtectedRegion implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 213123517828282L;
|
||||
private final double x, y, z;
|
||||
private final double radius;
|
||||
@ -381,6 +383,7 @@ public class ProtectArea extends AbstractService<TotalFreedomMod>
|
||||
|
||||
public class CantFindWorldException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CantFindWorldException(String string)
|
||||
@ -388,5 +391,7 @@ public class ProtectArea extends AbstractService<TotalFreedomMod>
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import net.pravian.aero.component.service.AbstractService;
|
||||
|
||||
public class ServerInterface extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public static final String COMPILE_NMS_VERSION = "v1_8_R3";
|
||||
|
||||
public ServerInterface(TotalFreedomMod plugin)
|
||||
|
@ -176,6 +176,7 @@ public class ServiceChecker extends AbstractService<TotalFreedomMod>
|
||||
|
||||
public class ServiceStatus
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
@Getter
|
||||
|
@ -36,6 +36,7 @@ import org.mcstats.Metrics;
|
||||
|
||||
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public static final long SERVICE_CHECKER_RATE = 120L;
|
||||
public static final int MAX_USERNAME_LENGTH = 20;
|
||||
//
|
||||
@ -118,7 +119,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
|
||||
FLog.info("Created by Madgeek1450 and Prozza");
|
||||
FLog.info("Version " + build.formattedVersion());
|
||||
FLog.info("Compiled " + build.date + " by " + build.builder);
|
||||
FLog.info("Compiled " + build.date + " by " + build.author);
|
||||
|
||||
final FUtil.MethodTimer timer = new FUtil.MethodTimer();
|
||||
timer.start();
|
||||
@ -224,10 +225,12 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
|
||||
public static class BuildProperties
|
||||
{
|
||||
public String builder;
|
||||
|
||||
public String author;
|
||||
public String version;
|
||||
public String number;
|
||||
public String head;
|
||||
public String date;
|
||||
public String head;
|
||||
|
||||
public void load()
|
||||
{
|
||||
@ -239,11 +242,11 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
props.load(in);
|
||||
in.close();
|
||||
|
||||
builder = props.getProperty("program.builder", "unknown");
|
||||
number = props.getProperty("program.buildnumber", "1");
|
||||
head = props.getProperty("program.buildhead", "unknown");
|
||||
date = props.getProperty("program.builddate", "unknown");
|
||||
|
||||
author = props.getProperty("program.build.author", "unknown");
|
||||
version = props.getProperty("program.build.version", "unknown");
|
||||
number = props.getProperty("program.build.number", "1");
|
||||
date = props.getProperty("program.build.date", "unknown");
|
||||
head = props.getProperty("program.build.head", "unknown");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
{
|
||||
|
||||
@Getter
|
||||
private String configKey;
|
||||
@Getter
|
||||
|
@ -28,6 +28,7 @@ import org.bukkit.plugin.ServicePriority;
|
||||
|
||||
public class AdminList extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final Map<String, Admin> allAdmins = Maps.newHashMap(); // Includes disabled admins
|
||||
// Only active admins below
|
||||
@ -333,78 +334,79 @@ public class AdminList extends AbstractService<TotalFreedomMod>
|
||||
}
|
||||
|
||||
/*
|
||||
public void addAdmin(OfflinePlayer player)
|
||||
{
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String ip = TFM_Util.getIp(player);
|
||||
final boolean canSuperIp = !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip);
|
||||
|
||||
if (nameTable.containsKey(name))
|
||||
{
|
||||
final Admin superadmin = nameTable.;
|
||||
superadmin.setActivated(true);
|
||||
|
||||
if (player.isOnline())
|
||||
{
|
||||
superadmin.setLastLogin(new Date());
|
||||
|
||||
if (ip != null && canSuperIp)
|
||||
{
|
||||
superadmin.addIp(ip);
|
||||
}
|
||||
}
|
||||
|
||||
save();
|
||||
updateTables();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ip == null)
|
||||
{
|
||||
TFM_Log.severe("Could not add superadmin: " + TFM_Util.formatPlayer(player));
|
||||
TFM_Log.severe("Could not retrieve IP!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!canSuperIp)
|
||||
{
|
||||
TFM_Log.warning("Could not add superadmin: " + TFM_Util.formatPlayer(player));
|
||||
TFM_Log.warning("IP " + ip + " may not be supered.");
|
||||
return;
|
||||
}
|
||||
|
||||
final Admin superadmin = new Admin(
|
||||
uuid,
|
||||
player.getName(),
|
||||
new Date(),
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
superadmin.addIp(ip);
|
||||
|
||||
nameTable.put(uuid, superadmin);
|
||||
|
||||
updateTables();
|
||||
}
|
||||
|
||||
public void removeAdmin(OfflinePlayer player)
|
||||
{
|
||||
final UUID uuid = TFM_UuidManager.getUniqueId(player);
|
||||
|
||||
if (!nameTable.containsKey(uuid))
|
||||
{
|
||||
TFM_Log.warning("Could not remove admin: " + TFM_Util.formatPlayer(player));
|
||||
TFM_Log.warning("Player is not an admin!");
|
||||
return;
|
||||
}
|
||||
|
||||
final Admin superadmin = nameTable.get(uuid);
|
||||
superadmin.setActivated(false);
|
||||
Command_logs.deactivateSuperadmin(superadmin);
|
||||
|
||||
updateTables();
|
||||
}*/
|
||||
* public void addAdmin(OfflinePlayer player)
|
||||
* {
|
||||
* final String name = player.getName().toLowerCase();
|
||||
* final String ip = TFM_Util.getIp(player);
|
||||
* final boolean canSuperIp = !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip);
|
||||
*
|
||||
* if (nameTable.containsKey(name))
|
||||
* {
|
||||
* final Admin superadmin = nameTable.;
|
||||
* superadmin.setActivated(true);
|
||||
*
|
||||
* if (player.isOnline())
|
||||
* {
|
||||
* superadmin.setLastLogin(new Date());
|
||||
*
|
||||
* if (ip != null && canSuperIp)
|
||||
* {
|
||||
* superadmin.addIp(ip);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* save();
|
||||
* updateTables();
|
||||
* return;
|
||||
* }
|
||||
*
|
||||
* if (ip == null)
|
||||
* {
|
||||
* TFM_Log.severe("Could not add superadmin: " + TFM_Util.formatPlayer(player));
|
||||
* TFM_Log.severe("Could not retrieve IP!");
|
||||
* return;
|
||||
* }
|
||||
*
|
||||
* if (!canSuperIp)
|
||||
* {
|
||||
* TFM_Log.warning("Could not add superadmin: " + TFM_Util.formatPlayer(player));
|
||||
* TFM_Log.warning("IP " + ip + " may not be supered.");
|
||||
* return;
|
||||
* }
|
||||
*
|
||||
* final Admin superadmin = new Admin(
|
||||
* uuid,
|
||||
* player.getName(),
|
||||
* new Date(),
|
||||
* "",
|
||||
* false,
|
||||
* false,
|
||||
* true);
|
||||
* superadmin.addIp(ip);
|
||||
*
|
||||
* nameTable.put(uuid, superadmin);
|
||||
*
|
||||
* updateTables();
|
||||
* }
|
||||
*
|
||||
* public void removeAdmin(OfflinePlayer player)
|
||||
* {
|
||||
* final UUID uuid = TFM_UuidManager.getUniqueId(player);
|
||||
*
|
||||
* if (!nameTable.containsKey(uuid))
|
||||
* {
|
||||
* TFM_Log.warning("Could not remove admin: " + TFM_Util.formatPlayer(player));
|
||||
* TFM_Log.warning("Player is not an admin!");
|
||||
* return;
|
||||
* }
|
||||
*
|
||||
* final Admin superadmin = nameTable.get(uuid);
|
||||
* superadmin.setActivated(false);
|
||||
* Command_logs.deactivateSuperadmin(superadmin);
|
||||
*
|
||||
* updateTables();
|
||||
* }
|
||||
*/
|
||||
public void deactivateOldEntries(boolean verbose)
|
||||
{
|
||||
for (Admin admin : allAdmins.values())
|
||||
|
@ -20,6 +20,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class Ban implements ConfigLoadable, ConfigSavable, Validatable
|
||||
{
|
||||
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||
|
||||
@Getter
|
||||
|
@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class BanManager extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
private final Set<Ban> bans = Sets.newHashSet();
|
||||
private final Map<String, Ban> ipBans = Maps.newHashMap();
|
||||
private final Map<String, Ban> nameBans = Maps.newHashMap();
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class PermbanList extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final Set<String> permbannedNames = Sets.newHashSet();
|
||||
@Getter
|
||||
|
@ -21,6 +21,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
public class CommandBlocker extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
public static Pattern NUMBER_FLAG_PATTERN = Pattern.compile("(:([0-9]){5,})");
|
||||
//
|
||||
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
||||
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.blocking.command;
|
||||
|
||||
public enum CommandBlockerAction
|
||||
{
|
||||
|
||||
BLOCK("b"),
|
||||
BLOCK_AND_EJECT("a"),
|
||||
BLOCK_UNKNOWN("u");
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandBlockerEntry
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final CommandBlockerRank rank;
|
||||
@Getter
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public enum CommandBlockerRank
|
||||
{
|
||||
|
||||
ANYONE("a"),
|
||||
OP("o"),
|
||||
SUPER("s"),
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class WorldEditBridge extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
private static WorldEditPlugin worldEditPlugin = null;
|
||||
|
||||
public WorldEditBridge(TotalFreedomMod plugin)
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.block.Skull;
|
||||
|
||||
public class CageData
|
||||
{
|
||||
|
||||
private final FPlayer fPlayer;
|
||||
//
|
||||
private final List<BlockData> cageHistory = new ArrayList<BlockData>();
|
||||
@ -182,6 +183,7 @@ public class CageData
|
||||
|
||||
private static class BlockData
|
||||
{
|
||||
|
||||
public Material material;
|
||||
public Location location;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
|
||||
|
||||
public class CommandLoader extends AbstractService<TotalFreedomMod>
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final SimpleCommandHandler<TotalFreedomMod> handler;
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandParameters
|
||||
{
|
||||
|
||||
String description();
|
||||
|
||||
String usage();
|
||||
|
@ -7,6 +7,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandPermissions
|
||||
{
|
||||
|
||||
PlayerRank level();
|
||||
|
||||
SourceType source();
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
|
||||
public class Command_adminmode extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -10,7 +10,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Go to the AdminWorld.", usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | on | storm>]")
|
||||
@CommandParameters(description = "Go to the AdminWorld.",
|
||||
usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | on | storm>]")
|
||||
public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -21,7 +22,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
CommandMode commandMode = null;
|
||||
|
||||
@ -56,7 +57,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
case TELEPORT:
|
||||
{
|
||||
if (!(sender instanceof Player) || sender_p == null)
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -70,17 +71,17 @@ public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
}
|
||||
|
||||
if (adminWorld == null || sender_p.getWorld() == adminWorld)
|
||||
if (adminWorld == null || playerSender.getWorld() == adminWorld)
|
||||
{
|
||||
playerMsg("Going to the main world.");
|
||||
sender_p.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugin.wm.adminworld.canAccessWorld(sender_p))
|
||||
if (plugin.wm.adminworld.canAccessWorld(playerSender))
|
||||
{
|
||||
playerMsg("Going to the AdminWorld.");
|
||||
plugin.wm.adminworld.sendToWorld(sender_p);
|
||||
plugin.wm.adminworld.sendToWorld(playerSender);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -100,7 +101,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
else if ("purge".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
assertCommandPerms(sender, sender_p);
|
||||
assertCommandPerms(sender, playerSender);
|
||||
plugin.wm.adminworld.purgeGuestList();
|
||||
FUtil.adminAction(sender.getName(), "AdminWorld guest list purged.", false);
|
||||
}
|
||||
@ -111,7 +112,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
else if (args.length == 3)
|
||||
{
|
||||
assertCommandPerms(sender, sender_p);
|
||||
assertCommandPerms(sender, playerSender);
|
||||
|
||||
if ("add".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
@ -123,7 +124,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.wm.adminworld.addGuest(player, sender_p))
|
||||
if (plugin.wm.adminworld.addGuest(player, playerSender))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
|
||||
}
|
||||
@ -154,7 +155,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
case TIME:
|
||||
{
|
||||
assertCommandPerms(sender, sender_p);
|
||||
assertCommandPerms(sender, playerSender);
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
@ -178,7 +179,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
case WEATHER:
|
||||
{
|
||||
assertCommandPerms(sender, sender_p);
|
||||
assertCommandPerms(sender, playerSender);
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
@ -220,9 +221,9 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
|
||||
// TODO: Redo this properly
|
||||
private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException
|
||||
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
|
||||
{
|
||||
if (!(sender instanceof Player) || sender_p == null || !isAdmin(sender))
|
||||
if (!(sender instanceof Player) || playerSender == null || !isAdmin(sender))
|
||||
{
|
||||
throw new PermissionDeniedException();
|
||||
}
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
|
||||
public class Command_blockcmd extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -14,8 +14,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [outermaterial] [innermaterial]>")
|
||||
public class Command_cage extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
@ -25,7 +26,7 @@ public class Command_cage extends FreedomCommand
|
||||
if ("off".equals(args[0]) && sender instanceof Player)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
FPlayer playerdata = plugin.pl.getPlayer(sender_p);
|
||||
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
|
||||
playerdata.getCageData().setCaged(false);
|
||||
return true;
|
||||
|
@ -16,11 +16,12 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
|
||||
public class Command_cake extends FreedomCommand
|
||||
{
|
||||
|
||||
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
||||
private final Random random = new Random();
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
final StringBuilder output = new StringBuilder();
|
||||
|
||||
|
@ -12,9 +12,9 @@ public class Command_cartsit extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Player targetPlayer = sender_p;
|
||||
Player targetPlayer = playerSender;
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
@ -36,7 +36,7 @@ public class Command_cartsit extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (targetPlayer != sender_p && !isAdmin(sender))
|
||||
else if (targetPlayer != playerSender && !isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
|
||||
return true;
|
||||
|
@ -20,8 +20,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "No Description Yet", usage = "/<command>")
|
||||
public class Command_cbtool extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
@ -30,7 +31,7 @@ public class Command_cbtool extends FreedomCommand
|
||||
|
||||
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player)
|
||||
{
|
||||
Block targetBlock = DepreciationAggregator.getTargetBlock(sender_p, null, 100);
|
||||
Block targetBlock = DepreciationAggregator.getTargetBlock(playerSender, null, 100);
|
||||
playerMsg("Your target block: " + targetBlock.getLocation().toString());
|
||||
return true;
|
||||
}
|
||||
@ -78,6 +79,7 @@ public class Command_cbtool extends FreedomCommand
|
||||
|
||||
private static enum SubCommand
|
||||
{
|
||||
|
||||
PLAYER_DETECT("playerdetect", new SubCommandExecutable()
|
||||
{
|
||||
@Override
|
||||
@ -196,11 +198,13 @@ public class Command_cbtool extends FreedomCommand
|
||||
|
||||
private interface SubCommandExecutable
|
||||
{
|
||||
|
||||
public String execute(String[] args) throws SubCommandFailureException;
|
||||
}
|
||||
|
||||
private static class SubCommandFailureException extends Exception
|
||||
{
|
||||
|
||||
public SubCommandFailureException()
|
||||
{
|
||||
}
|
||||
@ -210,4 +214,5 @@ public class Command_cbtool extends FreedomCommand
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,11 +10,12 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Spy on commands", usage = "/<command>", aliases = "commandspy")
|
||||
public class Command_cmdspy extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(sender_p);
|
||||
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.setCommandSpy(!playerdata.cmdspyEnabled());
|
||||
playerMsg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled."));
|
||||
|
||||
|
@ -14,8 +14,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Essentials Interface Command - Color your current nickname.", usage = "/<command> <color>")
|
||||
public class Command_colorme extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
@ -47,7 +48,7 @@ public class Command_colorme extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
final String newNick = color + ChatColor.stripColor(sender_p.getDisplayName()).trim() + ChatColor.WHITE;
|
||||
final String newNick = color + ChatColor.stripColor(playerSender.getDisplayName()).trim() + ChatColor.WHITE;
|
||||
|
||||
plugin.esb.setNickname(sender.getName(), newNick);
|
||||
|
||||
|
@ -17,8 +17,9 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>", aliases = "cmdlist")
|
||||
public class Command_commandlist extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
List<String> commands = new ArrayList<String>();
|
||||
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Quickly change your own gamemode to creative, or define someone's username to change theirs.", usage = "/<command> [partialname]", aliases = "gmc")
|
||||
public class Command_creative extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
@ -26,7 +27,7 @@ public class Command_creative extends FreedomCommand
|
||||
Player player;
|
||||
if (args.length == 0)
|
||||
{
|
||||
player = sender_p;
|
||||
player = playerSender;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Telnet command - Send a chat message with chat formatting over telnet.", usage = "/<command> <message...>")
|
||||
public class Command_csay extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
|
@ -13,11 +13,12 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
@CommandParameters(description = "Make some noise.", usage = "/<command>")
|
||||
public class Command_deafen extends FreedomCommand
|
||||
{
|
||||
|
||||
private static final Random random = new Random();
|
||||
public static final double STEPS = 10.0;
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -12,8 +12,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "For developers only - debug things via reflection.", usage = "/<command>")
|
||||
public class Command_debug extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Essentials Interface Command - Remove the nickname of all players on the server.", usage = "/<command>")
|
||||
public class Command_denick extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all nicknames", false);
|
||||
|
||||
|
@ -12,8 +12,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
|
||||
public class Command_deop extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
|
||||
public class Command_deopall extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "De-opping all players on the server", true);
|
||||
|
||||
|
@ -20,8 +20,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
@CommandParameters(description = "Fill nearby dispensers with a set of items of your choice.", usage = "/<command> <radius> <comma,separated,items>")
|
||||
public class Command_dispfill extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
@ -67,7 +68,7 @@ public class Command_dispfill extends FreedomCommand
|
||||
final ItemStack[] itemsArray = items.toArray(new ItemStack[items.size()]);
|
||||
|
||||
int affected = 0;
|
||||
final Location centerLocation = sender_p.getLocation();
|
||||
final Location centerLocation = playerSender.getLocation();
|
||||
final Block centerBlock = centerLocation.getBlock();
|
||||
for (int xOffset = -radius; xOffset <= radius; xOffset++)
|
||||
{
|
||||
|
@ -16,8 +16,9 @@ import org.bukkit.util.Vector;
|
||||
@CommandParameters(description = "For the bad Superadmins", usage = "/<command> <playername>")
|
||||
public class Command_doom extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -10,81 +10,114 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Enchant items.", usage = "/<command> <list | addall | reset | add <name> | remove <name>>")
|
||||
public class Command_enchant extends FreedomCommand {
|
||||
public class Command_enchant extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemInHand = sender_p.getItemInHand();
|
||||
ItemStack itemInHand = playerSender.getItemInHand();
|
||||
|
||||
if (itemInHand == null) {
|
||||
if (itemInHand == null)
|
||||
{
|
||||
playerMsg("You are holding an invalid item.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
boolean has_enchantments = false;
|
||||
|
||||
StringBuilder possible_ench = new StringBuilder("Possible enchantments for held item: ");
|
||||
for (Enchantment ench : Enchantment.values()) {
|
||||
if (ench.canEnchantItem(itemInHand)) {
|
||||
for (Enchantment ench : Enchantment.values())
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
{
|
||||
has_enchantments = true;
|
||||
possible_ench.append(ench.getName()).append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
if (has_enchantments) {
|
||||
if (has_enchantments)
|
||||
{
|
||||
playerMsg(possible_ench.toString());
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("The held item has no enchantments.");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("addall")) {
|
||||
for (Enchantment ench : Enchantment.values()) {
|
||||
try {
|
||||
if (ench.canEnchantItem(itemInHand)) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("addall"))
|
||||
{
|
||||
for (Enchantment ench : Enchantment.values())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
{
|
||||
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
FLog.info("Error using " + ench.getName() + " on " + itemInHand.getType().name() + " held by " + sender_p.getName() + ".");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.info("Error using " + ench.getName() + " on " + itemInHand.getType().name() + " held by " + playerSender.getName() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg("Added all possible enchantments for this item.");
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
for (Enchantment ench : itemInHand.getEnchantments().keySet()) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
for (Enchantment ench : itemInHand.getEnchantments().keySet())
|
||||
{
|
||||
itemInHand.removeEnchantment(ench);
|
||||
}
|
||||
|
||||
playerMsg("Removed all enchantments.");
|
||||
} else {
|
||||
if (args.length < 2) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Enchantment ench = null;
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
ench = Enchantment.getByName(args[1]);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (ench == null) {
|
||||
if (ench == null)
|
||||
{
|
||||
playerMsg(args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
if (ench.canEnchantItem(itemInHand)) {
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
{
|
||||
if (ench.canEnchantItem(itemInHand))
|
||||
{
|
||||
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
||||
|
||||
playerMsg("Added enchantment: " + ench.getName());
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Can't use this enchantment on held item.");
|
||||
}
|
||||
} else if (args[0].equals("remove")) {
|
||||
}
|
||||
else if (args[0].equals("remove"))
|
||||
{
|
||||
itemInHand.removeEnchantment(ench);
|
||||
|
||||
playerMsg("Removed enchantment: " + ench.getName());
|
||||
|
@ -10,10 +10,11 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
|
||||
public class Command_ender extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_the_end");
|
||||
FUtil.gotoWorld(playerSender, server.getWorlds().get(0).getName() + "_the_end");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,9 @@ import org.bukkit.util.Vector;
|
||||
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
|
||||
public class Command_expel extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
double radius = 20.0;
|
||||
double strength = 5.0;
|
||||
@ -45,11 +46,11 @@ public class Command_expel extends FreedomCommand
|
||||
|
||||
List<String> pushedPlayers = new ArrayList<String>();
|
||||
|
||||
final Vector senderPos = sender_p.getLocation().toVector();
|
||||
final List<Player> players = sender_p.getWorld().getPlayers();
|
||||
final Vector senderPos = playerSender.getLocation().toVector();
|
||||
final List<Player> players = playerSender.getWorld().getPlayers();
|
||||
for (final Player player : players)
|
||||
{
|
||||
if (player.equals(sender_p))
|
||||
if (player.equals(playerSender))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Shows all IPs registered to a player", usage = "/<command> <player>")
|
||||
public class Command_findip extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -10,12 +10,13 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Goto the flatlands.", usage = "/<command>")
|
||||
public class Command_flatlands extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (ConfigEntry.FLATLANDS_GENERATE.getBoolean())
|
||||
{
|
||||
plugin.wm.flatlands.sendToWorld(sender_p);
|
||||
plugin.wm.flatlands.sendToWorld(playerSender);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ public class Command_fr extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
@ -12,14 +12,14 @@ public class Command_fuckoff extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
FPlayer player = plugin.pl.getPlayer(sender_p);
|
||||
FPlayer player = plugin.pl.getPlayer(playerSender);
|
||||
|
||||
if (!args[0].equals("on"))
|
||||
{
|
||||
|
@ -18,8 +18,10 @@ import org.bukkit.entity.Player;
|
||||
usage = "/<command> [list | [<kick | nameban | ipban | ban | op | deop | ci | fr | smite> <targethash>] ]")
|
||||
public class Command_gadmin extends FreedomCommand
|
||||
{
|
||||
|
||||
private enum GadminMode
|
||||
{
|
||||
|
||||
LIST("list"),
|
||||
KICK("kick"),
|
||||
NAMEBAN("nameban"),
|
||||
@ -61,7 +63,7 @@ public class Command_gadmin extends FreedomCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
|
||||
public class Command_gcmd extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
|
@ -16,8 +16,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Bans or unbans any player, even those who are not logged in anymore.", usage = "/<command> <purge | <ban | unban> <username>>")
|
||||
public class Command_glist extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
@ -17,8 +17,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Makes someone GTFO (deop and ip ban by username).", usage = "/<command> <partialname>")
|
||||
public class Command_gtfo extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
@ -17,17 +17,19 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
@CommandParameters(description = "View ticks-per-second", usage = "/<command>")
|
||||
public class Command_health extends FreedomCommand
|
||||
{
|
||||
|
||||
private static final int BYTES_PER_MB = 1024 * 1024;
|
||||
private static final DoubleRange TPS_RANGE = new DoubleRange(20.0 - 0.1, 20.0 + 0.1);
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
long usedMem = runtime.totalMemory() - runtime.freeMemory();
|
||||
|
||||
playerMsg("Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb");
|
||||
playerMsg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB) + "mb (" + new DecimalFormat("#").format(((double) usedMem / (double) runtime.totalMemory()) * 100.0) + "%)");
|
||||
playerMsg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB)
|
||||
+ "mb (" + new DecimalFormat("#").format(((double) usedMem / (double) runtime.totalMemory()) * 100.0) + "%)");
|
||||
playerMsg("Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb");
|
||||
playerMsg("Calculating ticks per second, please wait...");
|
||||
|
||||
@ -64,6 +66,7 @@ public class Command_health extends FreedomCommand
|
||||
|
||||
private class TFM_TickMeter
|
||||
{
|
||||
|
||||
private final AtomicInteger ticks = new AtomicInteger();
|
||||
private final TotalFreedomMod plugin;
|
||||
private long startTime;
|
||||
@ -98,4 +101,5 @@ public class Command_health extends FreedomCommand
|
||||
return (double) tickCount / ((double) elapsed / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,8 +14,9 @@ import org.bukkit.potion.PotionEffectType;
|
||||
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
|
||||
public class Command_invis extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
boolean smite = false;
|
||||
if (args.length >= 1)
|
||||
|
@ -12,8 +12,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info | sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
|
||||
public class Command_kicknoob extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true);
|
||||
|
||||
|
@ -16,8 +16,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Set a landmine trap.", usage = "/<command>")
|
||||
public class Command_landmine extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.LANDMINES_ENABLED.getBoolean())
|
||||
{
|
||||
@ -54,9 +55,9 @@ public class Command_landmine extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
final Block landmine = sender_p.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||
final Block landmine = playerSender.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||
landmine.setType(Material.TNT);
|
||||
plugin.lm.add(new Landmine(landmine.getLocation(), sender_p, radius));
|
||||
plugin.lm.add(new Landmine(landmine.getLocation(), playerSender, radius));
|
||||
|
||||
playerMsg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
|
||||
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Show the last command that someone used.", usage = "/<command> <player>")
|
||||
public class Command_lastcmd extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
@ -14,15 +14,17 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i]", aliases = "who")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
|
||||
private static enum ListFilter
|
||||
{
|
||||
|
||||
ALL,
|
||||
ADMINS,
|
||||
IMPOSTORS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
|
@ -9,11 +9,12 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Teleport to the spawn point for the current world.", usage = "/<command>", aliases = "worldspawn,gotospawn")
|
||||
public class Command_localspawn extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
sender_p.teleport(sender_p.getWorld().getSpawnLocation());
|
||||
playerMsg("Teleported to spawnpoint for world \"" + sender_p.getWorld().getName() + "\".");
|
||||
playerSender.teleport(playerSender.getWorld().getSpawnLocation());
|
||||
playerMsg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,9 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
@CommandParameters(description = "Block target's minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
|
||||
public class Command_lockup extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
@ -88,11 +89,11 @@ public class Command_lockup extends FreedomCommand
|
||||
|
||||
private void cancelLockup(FPlayer playerdata)
|
||||
{
|
||||
BukkitTask lockupScheduleID = playerdata.getLockupScheduleID();
|
||||
if (lockupScheduleID != null)
|
||||
BukkitTask lockupScheduleId = playerdata.getLockupScheduleID();
|
||||
if (lockupScheduleId != null)
|
||||
{
|
||||
lockupScheduleID.cancel();
|
||||
playerdata.setLockupScheduleID(null);
|
||||
lockupScheduleId.cancel();
|
||||
playerdata.setLockupScheduleId(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +108,7 @@ public class Command_lockup extends FreedomCommand
|
||||
|
||||
cancelLockup(playerdata);
|
||||
|
||||
playerdata.setLockupScheduleID(new BukkitRunnable()
|
||||
playerdata.setLockupScheduleId(new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
|
@ -25,8 +25,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
||||
public class Command_logs extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.UPDATE;
|
||||
|
||||
@ -35,7 +36,7 @@ public class Command_logs extends FreedomCommand
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
}
|
||||
|
||||
updateLogsRegistration(sender, sender_p, mode);
|
||||
updateLogsRegistration(sender, playerSender, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -47,10 +48,10 @@ public class Command_logs extends FreedomCommand
|
||||
|
||||
public static void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
|
||||
{
|
||||
final String logsRegisterURL = ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterUrl = ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = ConfigEntry.LOGS_SECRET.getString();
|
||||
|
||||
if (logsRegisterURL == null || logsRegisterPassword == null || logsRegisterURL.isEmpty() || logsRegisterPassword.isEmpty())
|
||||
if (logsRegisterUrl == null || logsRegisterPassword == null || logsRegisterUrl.isEmpty() || logsRegisterPassword.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -67,7 +68,7 @@ public class Command_logs extends FreedomCommand
|
||||
sender.sendMessage(ChatColor.YELLOW + "Connecting...");
|
||||
}
|
||||
|
||||
URL url = new URLBuilder(logsRegisterURL)
|
||||
URL url = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", mode.toString())
|
||||
.addQueryParameter("password", logsRegisterPassword)
|
||||
.addQueryParameter("name", targetName)
|
||||
@ -119,6 +120,7 @@ public class Command_logs extends FreedomCommand
|
||||
|
||||
public static enum LogsRegistrationMode
|
||||
{
|
||||
|
||||
UPDATE("update"), DELETE("delete");
|
||||
private final String mode;
|
||||
|
||||
@ -136,6 +138,7 @@ public class Command_logs extends FreedomCommand
|
||||
|
||||
private static class URLBuilder
|
||||
{
|
||||
|
||||
private final String requestPath;
|
||||
private final Map<String, String> queryStringMap = new HashMap<String, String>();
|
||||
|
||||
|
@ -9,47 +9,71 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Control mob rezzing parameters.", usage = "/<command> <on|off|setmax <count>|dragon|giant|ghast|slime>")
|
||||
public class Command_moblimiter extends FreedomCommand {
|
||||
public class Command_moblimiter extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on")) {
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_ENABLED.setBoolean(true);
|
||||
} else if (args[0].equalsIgnoreCase("off")) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("off"))
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_ENABLED.setBoolean(false);
|
||||
} else if (args[0].equalsIgnoreCase("dragon")) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("dragon"))
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.setBoolean(!ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean());
|
||||
} else if (args[0].equalsIgnoreCase("giant")) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("giant"))
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_DISABLE_GIANT.setBoolean(!ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean());
|
||||
} else if (args[0].equalsIgnoreCase("slime")) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("slime"))
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_DISABLE_SLIME.setBoolean(!ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean());
|
||||
} else if (args[0].equalsIgnoreCase("ghast")) {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("ghast"))
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_DISABLE_GHAST.setBoolean(!ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean());
|
||||
} else {
|
||||
if (args.length < 2) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("setmax")) {
|
||||
try {
|
||||
if (args[0].equalsIgnoreCase("setmax"))
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.MOB_LIMITER_MAX.setInteger(Math.max(0, Math.min(2000, Integer.parseInt(args[1]))));
|
||||
} catch (NumberFormatException nfex) {
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigEntry.MOB_LIMITER_ENABLED.getBoolean()) {
|
||||
if (ConfigEntry.MOB_LIMITER_ENABLED.getBoolean())
|
||||
{
|
||||
sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + ConfigEntry.MOB_LIMITER_MAX.getInteger() + ".");
|
||||
|
||||
playerMsg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Slime: " + (ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Ghast: " + (ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Moblimiter is disabled. No mob restrictions are in effect.");
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,9 @@ import org.bukkit.entity.Slime;
|
||||
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>", aliases = "mp")
|
||||
public class Command_mobpurge extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
playerMsg("Purging all mobs...");
|
||||
playerMsg(purgeMobs() + " mobs removed.");
|
||||
|
@ -14,8 +14,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
@CommandParameters(description = "Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.", usage = "/<command> <draw | sling>")
|
||||
public class Command_mp44 extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.MP44_ENABLED.getBoolean())
|
||||
{
|
||||
@ -28,7 +29,7 @@ public class Command_mp44 extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(sender_p);
|
||||
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
|
||||
if (args[0].equalsIgnoreCase("draw"))
|
||||
{
|
||||
@ -37,7 +38,7 @@ public class Command_mp44 extends FreedomCommand
|
||||
playerMsg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
|
||||
playerMsg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
|
||||
|
||||
sender_p.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
||||
playerSender.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,10 +10,11 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
|
||||
public class Command_nether extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_nether");
|
||||
FUtil.gotoWorld(playerSender, server.getWorlds().get(0).getName() + "_nether");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Essentials Interface Command - Remove distracting things from nicknames of all players on server.", usage = "/<command>", aliases = "nc")
|
||||
public class Command_nickclean extends FreedomCommand
|
||||
{
|
||||
|
||||
private static final ChatColor[] BLOCKED = new ChatColor[]
|
||||
{
|
||||
ChatColor.MAGIC,
|
||||
@ -22,10 +23,10 @@ public class Command_nickclean extends FreedomCommand
|
||||
ChatColor.UNDERLINE,
|
||||
ChatColor.BLACK
|
||||
};
|
||||
private static final Pattern REGEX = Pattern.compile("\\u00A7[" + StringUtils.join(BLOCKED, "") + "]");
|
||||
private static final Pattern REGEX = Pattern.compile(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCKED, "") + "]");
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames.", false);
|
||||
|
||||
|
@ -19,8 +19,9 @@ import org.bukkit.entity.Player;
|
||||
aliases = "nf")
|
||||
public class Command_nickfilter extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
boolean nickMatched = false;
|
||||
|
||||
|
@ -12,8 +12,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Essentials Interface Command - Nyanify your nickname.", usage = "/<command> <<nick> | off>")
|
||||
public class Command_nicknyan extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
@ -29,7 +30,7 @@ public class Command_nicknyan extends FreedomCommand
|
||||
|
||||
final String nickPlain = ChatColor.stripColor(FUtil.colorize(args[0].trim()));
|
||||
|
||||
if (!nickPlain.matches("^[a-zA-Z_0-9\u00a7]+$"))
|
||||
if (!nickPlain.matches("^[a-zA-Z_0-9" + ChatColor.COLOR_CHAR + "]+$"))
|
||||
{
|
||||
playerMsg("That nickname contains invalid characters.");
|
||||
return true;
|
||||
@ -42,7 +43,7 @@ public class Command_nicknyan extends FreedomCommand
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player == sender_p)
|
||||
if (player == playerSender)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -15,8 +15,9 @@ import org.bukkit.entity.Player;
|
||||
aliases = "adminchat")
|
||||
public class Command_o extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
@ -26,7 +27,7 @@ public class Command_o extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
FPlayer userinfo = plugin.pl.getPlayer(sender_p);
|
||||
FPlayer userinfo = plugin.pl.getPlayer(playerSender);
|
||||
userinfo.setAdminChat(!userinfo.inAdminChat());
|
||||
playerMsg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
|
||||
}
|
||||
|
@ -12,8 +12,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Switch server online-mode on and off.", usage = "/<command> <on | off>")
|
||||
public class Command_onlinemode extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
@ -13,8 +13,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
|
||||
public class Command_op extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s]")
|
||||
public class Command_opall extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Opping all players on the server", false);
|
||||
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Automatically ops user.", usage = "/<command>")
|
||||
public class Command_opme extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||
sender.setOp(true);
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
|
||||
public class Command_ops extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -15,8 +15,9 @@ import org.bukkit.util.Vector;
|
||||
usage = "/<command> <target> [<<power> | stop>]")
|
||||
public class Command_orbit extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
@ -19,14 +19,14 @@ public class Command_overlord extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.OVERLORD_IPS.getList().contains(Ips.getIp(sender_p)))
|
||||
if (!ConfigEntry.OVERLORD_IPS.getList().contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
try
|
||||
{
|
||||
List<?> ips = (List) MainConfig.getDefaults().get(ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (!ips.contains(Ips.getIp(sender_p)))
|
||||
if (!ips.contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
@ -45,14 +45,14 @@ public class Command_overlord extends FreedomCommand
|
||||
|
||||
if (args[0].equals("addme"))
|
||||
{
|
||||
plugin.al.addAdmin(new Admin(sender_p));
|
||||
plugin.al.addAdmin(new Admin(playerSender));
|
||||
playerMsg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("removeme"))
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(sender_p);
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
if (admin != null)
|
||||
{
|
||||
plugin.al.removeAdmin(admin);
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> reload")
|
||||
public class Command_permban extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -13,8 +13,9 @@ import org.bukkit.plugin.PluginManager;
|
||||
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
||||
public class Command_plugincontrol extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
|
@ -18,8 +18,9 @@ import org.bukkit.potion.PotionEffectType;
|
||||
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>")
|
||||
public class Command_potion extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 1 || args.length == 2)
|
||||
{
|
||||
@ -53,7 +54,7 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("clear"))
|
||||
{
|
||||
Player target = sender_p;
|
||||
Player target = playerSender;
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
@ -66,7 +67,7 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(sender_p))
|
||||
if (!target.equals(playerSender))
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
@ -85,7 +86,7 @@ public class Command_potion extends FreedomCommand
|
||||
target.removePotionEffect(potion_effect.getType());
|
||||
}
|
||||
|
||||
playerMsg("Cleared all active potion effects " + (!target.equals(sender_p) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
||||
playerMsg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -96,7 +97,7 @@ public class Command_potion extends FreedomCommand
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
{
|
||||
Player target = sender_p;
|
||||
Player target = playerSender;
|
||||
|
||||
if (args.length == 5)
|
||||
{
|
||||
@ -110,7 +111,7 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(sender_p))
|
||||
if (!target.equals(playerSender))
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
@ -161,7 +162,7 @@ public class Command_potion extends FreedomCommand
|
||||
"Added potion effect: " + new_effect.getType().getName()
|
||||
+ ", Duration: " + new_effect.getDuration()
|
||||
+ ", Amplifier: " + new_effect.getAmplifier()
|
||||
+ (!target.equals(sender_p) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
||||
+ (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -16,8 +16,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
@CommandParameters(description = "Validates if a given account is premium.", usage = "/<command> <player>", aliases = "prem")
|
||||
public class Command_premium extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ public class Command_protectarea extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||
{
|
||||
@ -85,7 +85,7 @@ public class Command_protectarea extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.pa.addProtectedArea(args[1], sender_p.getLocation(), radius);
|
||||
plugin.pa.addProtectedArea(args[1], playerSender.getLocation(), radius);
|
||||
|
||||
playerMsg("Area added. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
|
@ -12,8 +12,9 @@ import org.bukkit.potion.PotionEffect;
|
||||
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
|
||||
public class Command_purgeall extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Purging all player data", true);
|
||||
|
||||
|
@ -13,8 +13,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Quick De-Op - deop someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qdeop extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
@ -13,8 +13,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qop extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
@ -15,20 +15,21 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Shows nearby people sorted by distance.", usage = "/<command> [range]")
|
||||
public class Command_radar extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Location sender_pos = sender_p.getLocation();
|
||||
Location playerSenderos = playerSender.getLocation();
|
||||
|
||||
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
|
||||
|
||||
for (Player player : sender_pos.getWorld().getPlayers())
|
||||
for (Player player : playerSenderos.getWorld().getPlayers())
|
||||
{
|
||||
if (!player.equals(sender_p))
|
||||
if (!player.equals(playerSender))
|
||||
{
|
||||
try
|
||||
{
|
||||
radar_data.add(new TFM_RadarData(player, sender_pos.distance(player.getLocation()), player.getLocation()));
|
||||
radar_data.add(new TFM_RadarData(player, playerSenderos.distance(player.getLocation()), player.getLocation()));
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
@ -44,7 +45,7 @@ public class Command_radar extends FreedomCommand
|
||||
|
||||
Collections.sort(radar_data, new TFM_RadarData());
|
||||
|
||||
playerMsg("People nearby in " + sender_pos.getWorld().getName() + ":", ChatColor.YELLOW);
|
||||
playerMsg("People nearby in " + playerSenderos.getWorld().getName() + ":", ChatColor.YELLOW);
|
||||
|
||||
int countmax = 5;
|
||||
if (args.length == 1)
|
||||
@ -75,6 +76,7 @@ public class Command_radar extends FreedomCommand
|
||||
|
||||
private class TFM_RadarData implements Comparator<TFM_RadarData>
|
||||
{
|
||||
|
||||
public Player player;
|
||||
public double distance;
|
||||
public Location location;
|
||||
@ -107,4 +109,5 @@ public class Command_radar extends FreedomCommand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Shows your rank.", usage = "/<command>")
|
||||
public class Command_rank extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole && args.length < 1)
|
||||
{
|
||||
@ -29,7 +30,7 @@ public class Command_rank extends FreedomCommand
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
playerMsg(sender.getName() + " is " + plugin.rm.getDisplayRank(sender_p).getColoredLoginMessage(), ChatColor.AQUA);
|
||||
playerMsg(sender.getName() + " is " + plugin.rm.getDisplayRank(playerSender).getColoredLoginMessage(), ChatColor.AQUA);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
|
||||
public class Command_rawsay extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
|
@ -10,8 +10,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> <carts>")
|
||||
public class Command_rd extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all server entities.", true);
|
||||
playerMsg((plugin.ew.wipeEntities(true, true)) + " entities removed.");
|
||||
|
@ -13,8 +13,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Report a player for admins to see.", usage = "/<command> <player> <reason>")
|
||||
public class Command_report extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
@ -31,7 +32,7 @@ public class Command_report extends FreedomCommand
|
||||
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
if (player.equals(sender_p))
|
||||
if (player.equals(playerSender))
|
||||
{
|
||||
playerMsg(ChatColor.RED + "Please, don't try to report yourself.");
|
||||
return true;
|
||||
@ -45,7 +46,7 @@ public class Command_report extends FreedomCommand
|
||||
}
|
||||
|
||||
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
FUtil.reportAction(sender_p, player, report);
|
||||
FUtil.reportAction(playerSender, player, report);
|
||||
|
||||
playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
||||
|
||||
|
@ -17,8 +17,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
|
||||
public class Command_ro extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1 || args.length > 3)
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user