mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-22 18:04:57 +00:00
Initial commit
This commit is contained in:
parent
21c0833f14
commit
565152e09a
221 changed files with 4718 additions and 8299 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -20,3 +20,14 @@ Thumbs.db
|
|||
|
||||
# TFM files
|
||||
buildcreator.properties
|
||||
|
||||
# netbeans excludes (because fuck you nobody uses that shit anymore)
|
||||
nbproject/
|
||||
|
||||
# iml exclude
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# maven exclude
|
||||
target/
|
||||
dependency-reduced-pom.xml
|
|
@ -1,12 +1,12 @@
|
|||
# Contributing to TotalFreedomMod #
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, it can be used in a variety of other configurations with minimal fuss.
|
||||
# Contributing to TFM 4.3 Reloaded #
|
||||
TFM 4.3 Reloaded is a CraftBukkit server plugin designed primarily to support legacy TotalFreedom clones. However, it can be used in a variety of other configurations with minimal fuss.
|
||||
|
||||
For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that explain this process in further detail.
|
||||
|
||||
## Quick Guide ##
|
||||
1. Create or find an issue on our [Issue Tracker](https://github.com/TotalFreedom/TotalFreedomMod/issues).
|
||||
2. Does your change fits TotalFreedomMod's goals?
|
||||
3. Fork TotalFreedomMod if you haven't done so already.
|
||||
1. Create or find an issue on our [Issue Tracker](https://github.com/TotalFreedom/TFM 4.3 Reloaded/issues).
|
||||
2. Does your change fits TFM 4.3 Reloaded's goals?
|
||||
3. Fork TFM 4.3 Reloaded if you haven't done so already.
|
||||
4. Make a branch dedicated to your change.
|
||||
5. Make your change.
|
||||
6. Commit your change according to the [committing guidelines](#committing-your-changes).
|
||||
|
@ -17,11 +17,11 @@ For those who wish to contribute, we encourage you to fork the repository and su
|
|||
* If the issue does not exist already, create it.
|
||||
* Clearly describe the issue.
|
||||
* If your issue is a bug, describe the steps needed to reproduce it.
|
||||
* If your issue is a feature request, ensure it fits TotalFreedomMod's goals and describe your feature in detail.
|
||||
* If your issue is a feature request, ensure it fits TFM 4.3 Reloaded's goals and describe your feature in detail.
|
||||
* Fork the repository on GitHub.
|
||||
|
||||
## Does the change fit TotalFreedomMod's goals? ##
|
||||
As a rough guideline, ask yourself the following questions to determine if your proposed change fits the TotalFreedomMod project's goals. Please remember that this is only a rough guideline and may or may not reflect the definitive answer to this question.
|
||||
## Does the change fit TFM 4.3 Reloaded's goals? ##
|
||||
As a rough guideline, ask yourself the following questions to determine if your proposed change fits the TFM 4.3 Reloaded project's goals. Please remember that this is only a rough guideline and may or may not reflect the definitive answer to this question.
|
||||
|
||||
* Is the change in line with the principles of "Total Freedom"?
|
||||
TotalFreedom is a freedom-based server. We don't normally make changes that restrict players unless absolutely necessary.
|
||||
|
@ -90,8 +90,6 @@ meaning you can't remove your current IP or an IP that doesn't belong to you.
|
|||
* Please do not spread your contribution over several pull-requests.
|
||||
|
||||
## Additional Resources ##
|
||||
* [TotalFreedom information](http://totalfreedom.me)
|
||||
* [TotalFreedom forums](http://totalfreedom.boards.net)
|
||||
* [Bug tracker](https://github.com/TotalFreedom/TotalFreedomMod/issues)
|
||||
* [Bug tracker](https://github.com/TheDeus-Group/TFM-4.3-Reloaded/issues/)
|
||||
* [General GitHub documentation](http://help.github.com/)
|
||||
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# TotalFreedomMod #
|
||||
# TotalFreedomMod v4.3 Reloaded #
|
||||
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
||||
|
||||
This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van der Sar (Prozza) becoming heavily involved in its development some time later. It consists of over 85 custom coded commands and a large variety of distinguishable features not included in any other plugin. The plugin has since its beginning grown immensely. Together, with the main TotalFreedom server, TotalFreedomMod has a long-standing reputation of effectiveness whilst maintaining a clear feeling of openness towards the administrators and the players themselves.
|
||||
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod. For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
TotalFreedomMod v4.3 Reloaded is a fork of the original TotalFreedomMod v4.3 that hopes to fix bugs, improve quality of life and improve code readability.
|
||||
It is in no way meant to infringe upon the [orginal TotalFreedomMod license](LICENSE.md) in any way. Thank you for your understanding.
|
||||
|
|
26
build.xml
26
build.xml
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="TotalFreedomMod" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project TotalFreedomMod.</description>
|
||||
<import file="nbproject/build-impl.xml" />
|
||||
|
||||
<target name="-pre-jar">
|
||||
<copy file="buildcreator.default.properties" tofile="buildcreator.properties" overwrite="false" />
|
||||
|
||||
<property file="buildcreator.properties"/>
|
||||
<buildnumber file="buildnumber.properties" />
|
||||
|
||||
<propertyfile file="appinfo.properties">
|
||||
<entry key="program.buildnumber" value="${build.number}" />
|
||||
<entry key="program.builddate" type="date" value="now" pattern="MM/dd/yyyy hh:mm aa" />
|
||||
<entry key="program.buildcreator" value="${program.buildcreator}" />
|
||||
</propertyfile>
|
||||
<copy file="appinfo.properties" todir="${build.classes.dir}" />
|
||||
<delete file="appinfo.properties" />
|
||||
</target>
|
||||
|
||||
<target name="-post-jar">
|
||||
<!-- Cleanup -->
|
||||
<delete file="${dist.dir}/README.TXT" />
|
||||
<delete dir="${dist.dir}/lib/" />
|
||||
</target>
|
||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||
#
|
||||
# Build creator configuration
|
||||
#
|
||||
# Note: Do not edit this file! Edit the generated "buildcreator.properties" file instead.
|
||||
#
|
||||
program.buildcreator=Unknown
|
|
@ -1,3 +0,0 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Sat May 30 21:50:19 CEST 2015
|
||||
build.number=1053
|
BIN
libs/BukkitTelnet.jar
Normal file
BIN
libs/BukkitTelnet.jar
Normal file
Binary file not shown.
BIN
libs/Essentials-TF.jar
Normal file
BIN
libs/Essentials-TF.jar
Normal file
Binary file not shown.
BIN
libs/TF-WorldEdit.jar
Normal file
BIN
libs/TF-WorldEdit.jar
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,8 +0,0 @@
|
|||
build.xml.data.CRC32=7bf70ec5
|
||||
build.xml.script.CRC32=b1031e10
|
||||
build.xml.stylesheet.CRC32=28e38971@1.44.1.45
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=7bf70ec5
|
||||
nbproject/build-impl.xml.script.CRC32=8511de95
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
|
@ -1,102 +0,0 @@
|
|||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=TotalFreedomMod
|
||||
application.vendor=TotalFreedom
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=0
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.enableCommentFormatting=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/TotalFreedomMod.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
includes=**
|
||||
jar.archive.disabled=${jnlp.enabled}
|
||||
jar.compress=false
|
||||
jar.index=${jnlp.enabled}
|
||||
javac.classpath=\
|
||||
${libs.SpigotServer.classpath}:\
|
||||
${libs.TF-Essentials.classpath}:\
|
||||
${libs.TF-WorldEdit.classpath}:\
|
||||
${libs.BukkitTelnet.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
jnlp.codebase.type=no.codebase
|
||||
jnlp.descriptor=application
|
||||
jnlp.enabled=false
|
||||
jnlp.mixed.code=default
|
||||
jnlp.offline-allowed=false
|
||||
jnlp.signed=false
|
||||
jnlp.signing=
|
||||
jnlp.signing.alias=
|
||||
jnlp.signing.keystore=
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=true
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>TotalFreedomMod</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots/>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
123
pom.xml
Normal file
123
pom.xml
Normal file
|
@ -0,0 +1,123 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>me.StevenLawson</groupId>
|
||||
<artifactId>TotalFreedomMod</artifactId>
|
||||
<version>4.3-Reloaded</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.StevenLawson</groupId>
|
||||
<artifactId>worldedit</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/TF-WorldEdit.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.StevenLawson</groupId>
|
||||
<artifactId>BukkitTelnet</artifactId>
|
||||
<version>4.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/BukkitTelnet.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.earth2me</groupId>
|
||||
<artifactId>essentials</artifactId>
|
||||
<version>2.0-TF</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/Essentials-TF.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.javacord</groupId>
|
||||
<artifactId>javacord</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}-v${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Built-By/>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<generateUniqueDependencyReducedPom>false</generateUniqueDependencyReducedPom>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -1,107 +1,107 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class TFM_Log
|
||||
{
|
||||
private static final Logger FALLBACK_LOGGER = Logger.getLogger("Minecraft-Server");
|
||||
private static Logger serverLogger = null;
|
||||
private static Logger pluginLogger = null;
|
||||
|
||||
private TFM_Log()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
// Level.INFO:
|
||||
public static void info(String message)
|
||||
{
|
||||
info(message, false);
|
||||
}
|
||||
|
||||
public static void info(String message, Boolean raw)
|
||||
{
|
||||
log(Level.INFO, message, raw);
|
||||
}
|
||||
|
||||
public static void info(Throwable ex)
|
||||
{
|
||||
log(Level.INFO, ex);
|
||||
}
|
||||
|
||||
// Level.WARNING:
|
||||
public static void warning(String message)
|
||||
{
|
||||
warning(message, false);
|
||||
}
|
||||
|
||||
public static void warning(String message, Boolean raw)
|
||||
{
|
||||
log(Level.WARNING, message, raw);
|
||||
}
|
||||
|
||||
public static void warning(Throwable ex)
|
||||
{
|
||||
log(Level.WARNING, ex);
|
||||
}
|
||||
|
||||
// Level.SEVERE:
|
||||
public static void severe(String message)
|
||||
{
|
||||
severe(message, false);
|
||||
}
|
||||
|
||||
public static void severe(String message, Boolean raw)
|
||||
{
|
||||
log(Level.SEVERE, message, raw);
|
||||
}
|
||||
|
||||
public static void severe(Throwable ex)
|
||||
{
|
||||
log(Level.SEVERE, ex);
|
||||
}
|
||||
|
||||
// Utility
|
||||
private static void log(Level level, String message, boolean raw)
|
||||
{
|
||||
getLogger(raw).log(level, message);
|
||||
}
|
||||
|
||||
private static void log(Level level, Throwable throwable)
|
||||
{
|
||||
getLogger(false).log(level, null, throwable);
|
||||
}
|
||||
|
||||
public static void setServerLogger(Logger logger)
|
||||
{
|
||||
serverLogger = logger;
|
||||
}
|
||||
|
||||
public static void setPluginLogger(Logger logger)
|
||||
{
|
||||
pluginLogger = logger;
|
||||
}
|
||||
|
||||
private static Logger getLogger(boolean raw)
|
||||
{
|
||||
if (raw || pluginLogger == null)
|
||||
{
|
||||
return (serverLogger != null ? serverLogger : FALLBACK_LOGGER);
|
||||
}
|
||||
else
|
||||
{
|
||||
return pluginLogger;
|
||||
}
|
||||
}
|
||||
|
||||
public static Logger getPluginLogger()
|
||||
{
|
||||
return (pluginLogger != null ? pluginLogger : FALLBACK_LOGGER);
|
||||
}
|
||||
|
||||
public static Logger getServerLogger()
|
||||
{
|
||||
return (serverLogger != null ? serverLogger : FALLBACK_LOGGER);
|
||||
}
|
||||
}
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Log
|
||||
{
|
||||
private static final Logger FALLBACK_LOGGER = Logger.getLogger("Minecraft-Server");
|
||||
private static Logger serverLogger = null;
|
||||
private static Logger pluginLogger = null;
|
||||
|
||||
private Log()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
// Level.INFO:
|
||||
public static void info(String message)
|
||||
{
|
||||
info(message, false);
|
||||
}
|
||||
|
||||
public static void info(String message, Boolean raw)
|
||||
{
|
||||
log(Level.INFO, message, raw);
|
||||
}
|
||||
|
||||
public static void info(Throwable ex)
|
||||
{
|
||||
log(Level.INFO, ex);
|
||||
}
|
||||
|
||||
// Level.WARNING:
|
||||
public static void warning(String message)
|
||||
{
|
||||
warning(message, false);
|
||||
}
|
||||
|
||||
public static void warning(String message, Boolean raw)
|
||||
{
|
||||
log(Level.WARNING, message, raw);
|
||||
}
|
||||
|
||||
public static void warning(Throwable ex)
|
||||
{
|
||||
log(Level.WARNING, ex);
|
||||
}
|
||||
|
||||
// Level.SEVERE:
|
||||
public static void severe(String message)
|
||||
{
|
||||
severe(message, false);
|
||||
}
|
||||
|
||||
public static void severe(String message, Boolean raw)
|
||||
{
|
||||
log(Level.SEVERE, message, raw);
|
||||
}
|
||||
|
||||
public static void severe(Throwable ex)
|
||||
{
|
||||
log(Level.SEVERE, ex);
|
||||
}
|
||||
|
||||
// Utility
|
||||
private static void log(Level level, String message, boolean raw)
|
||||
{
|
||||
getLogger(raw).log(level, message);
|
||||
}
|
||||
|
||||
private static void log(Level level, Throwable throwable)
|
||||
{
|
||||
getLogger(false).log(level, null, throwable);
|
||||
}
|
||||
|
||||
public static void setServerLogger(Logger logger)
|
||||
{
|
||||
serverLogger = logger;
|
||||
}
|
||||
|
||||
public static void setPluginLogger(Logger logger)
|
||||
{
|
||||
pluginLogger = logger;
|
||||
}
|
||||
|
||||
private static Logger getLogger(boolean raw)
|
||||
{
|
||||
if (raw || pluginLogger == null)
|
||||
{
|
||||
return (serverLogger != null ? serverLogger : FALLBACK_LOGGER);
|
||||
}
|
||||
else
|
||||
{
|
||||
return pluginLogger;
|
||||
}
|
||||
}
|
||||
|
||||
public static Logger getPluginLogger()
|
||||
{
|
||||
return (pluginLogger != null ? pluginLogger : FALLBACK_LOGGER);
|
||||
}
|
||||
|
||||
public static Logger getServerLogger()
|
||||
{
|
||||
return (serverLogger != null ? serverLogger : FALLBACK_LOGGER);
|
||||
}
|
||||
}
|
|
@ -1,22 +1,30 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import static me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener.DEFAULT_PORT;
|
||||
import net.minecraft.server.v1_8_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R2.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R2.PropertyManager;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.util.SynchronousUtil;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R3.PropertyManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
|
||||
public class TFM_ServerInterface
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static me.StevenLawson.TotalFreedomMod.listener.PlayerListener.DEFAULT_PORT;
|
||||
|
||||
public class Server
|
||||
{
|
||||
public static final String COMPILE_NMS_VERSION = "v1_8_R2";
|
||||
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
||||
|
@ -43,8 +51,8 @@ public class TFM_ServerInterface
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.warning("Could not purge the whitelist!");
|
||||
TFM_Log.warning(ex);
|
||||
Log.warning("Could not purge the whitelist!");
|
||||
Log.warning(ex);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
@ -67,7 +75,7 @@ public class TFM_ServerInterface
|
|||
public static void handlePlayerPreLogin(AsyncPlayerPreLoginEvent event)
|
||||
{
|
||||
final String ip = event.getAddress().getHostAddress().trim();
|
||||
final boolean isAdmin = TFM_AdminList.isSuperAdminSafe(null, ip);
|
||||
final boolean isAdmin = AdminList.isSuperAdminSafe(null, ip);
|
||||
|
||||
// Check if the player is already online
|
||||
for (Player onlinePlayer : TotalFreedomMod.server.getOnlinePlayers())
|
||||
|
@ -81,7 +89,7 @@ public class TFM_ServerInterface
|
|||
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "Your username is already logged into this server.");
|
||||
} else {
|
||||
event.allow();
|
||||
TFM_Sync.playerKick(onlinePlayer, "An admin just logged in with the username you are using.");
|
||||
SynchronousUtil.playerKick(onlinePlayer, "An admin just logged in with the username you are using.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -89,11 +97,11 @@ public class TFM_ServerInterface
|
|||
|
||||
public static void handlePlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
final Server server = TotalFreedomMod.server;
|
||||
final org.bukkit.Server server = TotalFreedomMod.server;
|
||||
final Player player = event.getPlayer();
|
||||
final String username = player.getName();
|
||||
final String ip = event.getAddress().getHostAddress().trim();
|
||||
final UUID uuid = TFM_UuidManager.newPlayer(player, ip);
|
||||
final UUID uuid = UUIDManager.newPlayer(player, ip);
|
||||
|
||||
// Check username length
|
||||
if (username.length() < 3 || username.length() > TotalFreedomMod.MAX_USERNAME_LENGTH)
|
||||
|
@ -110,26 +118,26 @@ public class TFM_ServerInterface
|
|||
}
|
||||
|
||||
// Check force-IP match
|
||||
if (TFM_ConfigEntry.FORCE_IP_ENABLED.getBoolean())
|
||||
if (ConfigurationEntry.FORCE_IP_ENABLED.getBoolean())
|
||||
{
|
||||
final String hostname = event.getHostname().replace("FML", ""); // Forge fix - https://github.com/TotalFreedom/TotalFreedomMod/issues/493
|
||||
final String connectAddress = TFM_ConfigEntry.SERVER_ADDRESS.getString();
|
||||
final String connectAddress = ConfigurationEntry.SERVER_ADDRESS.getString();
|
||||
final int connectPort = TotalFreedomMod.server.getPort();
|
||||
|
||||
if (!hostname.equalsIgnoreCase(connectAddress + ":" + connectPort) && !hostname.equalsIgnoreCase(connectAddress + ".:" + connectPort))
|
||||
{
|
||||
final int forceIpPort = TFM_ConfigEntry.FORCE_IP_PORT.getInteger();
|
||||
final int forceIpPort = ConfigurationEntry.FORCE_IP_PORT.getInteger();
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||
TFM_ConfigEntry.FORCE_IP_KICKMSG.getString()
|
||||
.replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString() + (forceIpPort == DEFAULT_PORT ? "" : ":" + forceIpPort)));
|
||||
ConfigurationEntry.FORCE_IP_KICKMSG.getString()
|
||||
.replace("%address%", ConfigurationEntry.SERVER_ADDRESS.getString() + (forceIpPort == DEFAULT_PORT ? "" : ":" + forceIpPort)));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if player is admin
|
||||
// Not safe to use TFM_Util.isSuperAdmin(player) because player.getAddress() will return a null until after player login.
|
||||
final boolean isAdmin = TFM_AdminList.isSuperAdminSafe(uuid, ip);
|
||||
// Not safe to use Utilities.isSuperAdmin(player) because player.getAddress() will return a null until after player login.
|
||||
final boolean isAdmin = AdminList.isSuperAdminSafe(uuid, ip);
|
||||
|
||||
// Validation below this point
|
||||
if (isAdmin) // Player is superadmin
|
||||
|
@ -142,7 +150,7 @@ public class TFM_ServerInterface
|
|||
{
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(onlinePlayer))
|
||||
if (!AdminList.isSuperAdmin(onlinePlayer))
|
||||
{
|
||||
onlinePlayer.kickPlayer("You have been kicked to free up room for an admin.");
|
||||
count--;
|
||||
|
@ -173,7 +181,7 @@ public class TFM_ServerInterface
|
|||
}
|
||||
|
||||
// Admin-only mode
|
||||
if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
if (ConfigurationEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER, "Server is temporarily open to admins only.");
|
||||
return;
|
||||
|
@ -197,43 +205,43 @@ public class TFM_ServerInterface
|
|||
}
|
||||
|
||||
// UUID ban
|
||||
if (TFM_BanManager.isUuidBanned(uuid))
|
||||
if (BanManager.isUuidBanned(uuid))
|
||||
{
|
||||
final TFM_Ban ban = TFM_BanManager.getByUuid(uuid);
|
||||
final Ban ban = BanManager.getByUuid(uuid);
|
||||
event.disallow(Result.KICK_OTHER, ban.getKickMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
// IP ban
|
||||
if (TFM_BanManager.isIpBanned(ip))
|
||||
if (BanManager.isIpBanned(ip))
|
||||
{
|
||||
final TFM_Ban ban = TFM_BanManager.getByIp(ip);
|
||||
final Ban ban = BanManager.getByIp(ip);
|
||||
event.disallow(Result.KICK_OTHER, ban.getKickMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
// Permbanned IPs
|
||||
for (String testIp : TFM_PermbanList.getPermbannedIps())
|
||||
for (String testIp : PermbanList.getPermbannedIps())
|
||||
{
|
||||
if (TFM_Util.fuzzyIpMatch(testIp, ip, 4))
|
||||
if (Utilities.fuzzyIpMatch(testIp, ip, 4))
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER,
|
||||
ChatColor.RED + "Your IP address is permanently banned from this server.\n"
|
||||
+ "Release procedures are available at\n"
|
||||
+ ChatColor.GOLD + TFM_ConfigEntry.SERVER_PERMBAN_URL.getString());
|
||||
+ ChatColor.GOLD + ConfigurationEntry.SERVER_PERMBAN_URL.getString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Permbanned usernames
|
||||
for (String testPlayer : TFM_PermbanList.getPermbannedPlayers())
|
||||
for (String testPlayer : PermbanList.getPermbannedPlayers())
|
||||
{
|
||||
if (testPlayer.equalsIgnoreCase(username))
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER,
|
||||
ChatColor.RED + "Your username is permanently banned from this server.\n"
|
||||
+ "Release procedures are available at\n"
|
||||
+ ChatColor.GOLD + TFM_ConfigEntry.SERVER_PERMBAN_URL.getString());
|
||||
+ ChatColor.GOLD + ConfigurationEntry.SERVER_PERMBAN_URL.getString());
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.announcer.Announcer;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.DiscordBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.CommandHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.FreedomCommand;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.deprecated.bridge.BukkitTelnetBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.gamerule.GameRuleHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.httpd.HTTPDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.listener.*;
|
||||
import me.StevenLawson.TotalFreedomMod.player.HeartBeat;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import me.StevenLawson.TotalFreedomMod.world.AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.world.FlatlandsWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.world.ProtectedArea;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class TotalFreedomMod extends JavaPlugin {
|
||||
public static final long HEARTBEAT_RATE = 5L; // Seconds
|
||||
public static final long SERVICE_CHECKER_RATE = 120L;
|
||||
public static final int MAX_USERNAME_LENGTH = 20;
|
||||
//
|
||||
public static final String CONFIG_FILENAME = "config.yml";
|
||||
public static final String SUPERADMIN_FILENAME = "superadmin.yml";
|
||||
public static final String PERMBAN_FILENAME = "permban.yml";
|
||||
public static final String UUID_FILENAME = "uuids.db";
|
||||
public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat";
|
||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||
//
|
||||
@Deprecated
|
||||
public static final String YOU_ARE_NOT_OP = FreedomCommand.YOU_ARE_NOT_OP;
|
||||
//
|
||||
public static String buildNumber = "1";
|
||||
public static String buildDate = Utilities.dateToString(new Date());
|
||||
public static String buildCreator = "Unknown";
|
||||
//
|
||||
public static org.bukkit.Server server;
|
||||
public static TotalFreedomMod plugin;
|
||||
public static String pluginName;
|
||||
public static String pluginVersion;
|
||||
//
|
||||
public static boolean lockdownEnabled = false;
|
||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<>();
|
||||
public static Logger logger;
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
TotalFreedomMod.plugin = this;
|
||||
TotalFreedomMod.logger = this.getLogger();
|
||||
TotalFreedomMod.server = plugin.getServer();
|
||||
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
||||
TotalFreedomMod.pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
Log.setPluginLogger(plugin.getLogger());
|
||||
Log.setServerLogger(server.getLogger());
|
||||
|
||||
setAppProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
Log.info("Made by Madgeek1450 and Prozza");
|
||||
Log.info("Compiled " + buildDate + " by " + buildCreator);
|
||||
|
||||
final Utilities.MethodTimer timer = new Utilities.MethodTimer();
|
||||
timer.start();
|
||||
|
||||
if (!Server.COMPILE_NMS_VERSION.equals(Utilities.getNmsVersion()))
|
||||
{
|
||||
Log.warning(pluginName + " is compiled for " + Server.COMPILE_NMS_VERSION + " but the server is running "
|
||||
+ "version " + Utilities.getNmsVersion() + "!");
|
||||
Log.warning("This might result in unexpected behaviour!");
|
||||
}
|
||||
|
||||
Utilities.deleteCoreDumps();
|
||||
Utilities.deleteFolder(new File("./_deleteme"));
|
||||
|
||||
// Create backups
|
||||
Utilities.createBackups(CONFIG_FILENAME, true);
|
||||
Utilities.createBackups(SUPERADMIN_FILENAME);
|
||||
Utilities.createBackups(PERMBAN_FILENAME);
|
||||
|
||||
// Load services
|
||||
UUIDManager.load();
|
||||
AdminList.load();
|
||||
PermbanList.load();
|
||||
PlayerList.load();
|
||||
BanManager.load();
|
||||
Announcer.load();
|
||||
ProtectedArea.load();
|
||||
DiscordBridge.load();
|
||||
|
||||
// Start SuperAdmin service
|
||||
server.getServicesManager().register(Function.class, AdminList.SUPERADMIN_SERVICE, plugin, ServicePriority.Normal);
|
||||
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
pm.registerEvents(new EntityListener(), plugin);
|
||||
pm.registerEvents(new BlockListener(), plugin);
|
||||
pm.registerEvents(new PlayerListener(), plugin);
|
||||
pm.registerEvents(new WeatherListener(), plugin);
|
||||
pm.registerEvents(new ServerListener(), plugin);
|
||||
|
||||
// Bridge
|
||||
pm.registerEvents(new BukkitTelnetBridge(), plugin);
|
||||
pm.registerEvents(new WorldEditListener(), plugin);
|
||||
|
||||
try {
|
||||
FlatlandsWorld.getInstance().getWorld();
|
||||
} catch (Exception ex) {
|
||||
Log.warning("Could not load world: Flatlands");
|
||||
}
|
||||
|
||||
try {
|
||||
AdminWorld.getInstance().getWorld();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.warning("Could not load world: AdminWorld");
|
||||
}
|
||||
|
||||
// Initialize game rules
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_DAYLIGHT_CYCLE, !ConfigurationEntry.DISABLE_NIGHT.getBoolean(), false);
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_FIRE_TICK, ConfigurationEntry.ALLOW_FIRE_SPREAD.getBoolean(), false);
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_MOB_LOOT, false, false);
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !ConfigurationEntry.MOB_LIMITER_ENABLED.getBoolean(), false);
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_TILE_DROPS, false, false);
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.MOB_GRIEFING, false, false);
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.NATURAL_REGENERATION, true, false);
|
||||
GameRuleHandler.commitGameRules();
|
||||
|
||||
// Disable weather
|
||||
if (ConfigurationEntry.DISABLE_WEATHER.getBoolean())
|
||||
{
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
world.setThundering(false);
|
||||
world.setStorm(false);
|
||||
world.setThunderDuration(0);
|
||||
world.setWeatherDuration(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Heartbeat
|
||||
new HeartBeat(plugin).runTaskTimer(plugin, HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||
|
||||
// Start services
|
||||
HTTPDManager.start();
|
||||
|
||||
timer.update();
|
||||
|
||||
Log.info("Version " + pluginVersion + " for " + Server.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
||||
|
||||
// Metrics @ http://mcstats.org/plugin/TotalFreedomMod
|
||||
// No longer exist!
|
||||
/*try
|
||||
{
|
||||
final Metrics metrics = new Metrics(plugin);
|
||||
metrics.start();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Log.warning("Failed to submit metrics data: " + ex.getMessage());
|
||||
}*/
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
CommandLoader.scan();
|
||||
CommandBlocker.load();
|
||||
|
||||
// Add spawnpoints later - https://github.com/TotalFreedom/TotalFreedomMod/issues/438
|
||||
ProtectedArea.autoAddSpawnpoints();
|
||||
}
|
||||
}.runTaskLater(plugin, 20L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
HTTPDManager.stop();
|
||||
BanManager.save();
|
||||
UUIDManager.close();
|
||||
DiscordBridge.stop();
|
||||
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
|
||||
Log.info("Plugin disabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
return CommandHandler.handleCommand(sender, cmd, commandLabel, args);
|
||||
}
|
||||
|
||||
private static void setAppProperties()
|
||||
{
|
||||
try
|
||||
{
|
||||
//final InputStream in = plugin.getResource("appinfo.properties");
|
||||
Properties props = new Properties();
|
||||
|
||||
// in = plugin.getClass().getResourceAsStream("/appinfo.properties");
|
||||
//props.load(in);
|
||||
//in.close();
|
||||
|
||||
//TotalFreedomMod.buildNumber = props.getProperty("program.buildnumber");
|
||||
//TotalFreedomMod.buildDate = props.getProperty("program.builddate");
|
||||
//TotalFreedomMod.buildCreator = props.getProperty("program.buildcreator");
|
||||
TotalFreedomMod.buildNumber = "1337";
|
||||
TotalFreedomMod.buildCreator = "You!";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.severe("Could not load App properties!");
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,14 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class TFM_Admin
|
||||
import java.util.*;
|
||||
|
||||
public class Admin
|
||||
{
|
||||
private final UUID uuid;
|
||||
private String lastLoginName;
|
||||
|
@ -23,7 +20,7 @@ public class TFM_Admin
|
|||
private Date lastLogin;
|
||||
private boolean isActivated;
|
||||
|
||||
public TFM_Admin(UUID uuid, String lastLoginName, Date lastLogin, String loginMessage, boolean isTelnetAdmin, boolean isSeniorAdmin, boolean isActivated)
|
||||
public Admin(UUID uuid, String lastLoginName, Date lastLogin, String loginMessage, boolean isTelnetAdmin, boolean isSeniorAdmin, boolean isActivated)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.lastLoginName = lastLoginName;
|
||||
|
@ -36,19 +33,19 @@ public class TFM_Admin
|
|||
this.isActivated = isActivated;
|
||||
}
|
||||
|
||||
public TFM_Admin(UUID uuid, ConfigurationSection section)
|
||||
public Admin(UUID uuid, ConfigurationSection section)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.lastLoginName = section.getString("last_login_name");
|
||||
this.ips = section.getStringList("ips");
|
||||
this.lastLogin = TFM_Util.stringToDate(section.getString("last_login", TFM_Util.dateToString(new Date(0L))));
|
||||
this.lastLogin = Utilities.stringToDate(section.getString("last_login", Utilities.dateToString(new Date(0L))));
|
||||
this.loginMessage = section.getString("custom_login_message", "");
|
||||
this.isSeniorAdmin = section.getBoolean("is_senior_admin", false);
|
||||
this.isTelnetAdmin = section.getBoolean("is_telnet_admin", false);
|
||||
this.consoleAliases = section.getStringList("console_aliases");
|
||||
this.isActivated = section.getBoolean("is_activated", true);
|
||||
|
||||
for (Iterator<?> it = TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).iterator(); it.hasNext();)
|
||||
for (Iterator<?> it = MainConfig.getList(ConfigurationEntry.NOADMIN_IPS).iterator(); it.hasNext();)
|
||||
{
|
||||
ips.remove((String) it.next());
|
||||
}
|
||||
|
@ -62,7 +59,7 @@ public class TFM_Admin
|
|||
output.append("UUID: ").append(uuid.toString()).append("\n");
|
||||
output.append("- Last Login Name: ").append(lastLoginName).append("\n");
|
||||
output.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n");
|
||||
output.append("- Last Login: ").append(TFM_Util.dateToString(lastLogin)).append("\n");
|
||||
output.append("- Last Login: ").append(Utilities.dateToString(lastLogin)).append("\n");
|
||||
output.append("- Custom Login Message: ").append(loginMessage).append("\n");
|
||||
output.append("- Is Senior Admin: ").append(isSeniorAdmin).append("\n");
|
||||
output.append("- Is Telnet Admin: ").append(isTelnetAdmin).append("\n");
|
|
@ -1,32 +1,31 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.admin;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.Command_logs;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.Command_logs;
|
||||
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.deprecated.twitter.TwitterHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import me.StevenLawson.TotalFreedomMod.world.AdminWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_AdminList
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AdminList
|
||||
{
|
||||
public static final Function<Player, Boolean> SUPERADMIN_SERVICE;
|
||||
private static final Map<UUID, TFM_Admin> adminList;
|
||||
private static final Map<UUID, Admin> adminList;
|
||||
private static final Set<UUID> superUUIDs;
|
||||
private static final Set<UUID> telnetUUIDs;
|
||||
private static final Set<UUID> seniorUUIDs;
|
||||
|
@ -36,7 +35,7 @@ public class TFM_AdminList
|
|||
|
||||
static
|
||||
{
|
||||
adminList = new HashMap<UUID, TFM_Admin>();
|
||||
adminList = new HashMap<UUID, Admin>();
|
||||
superUUIDs = new HashSet<UUID>();
|
||||
telnetUUIDs = new HashSet<UUID>();
|
||||
seniorUUIDs = new HashSet<UUID>();
|
||||
|
@ -54,7 +53,7 @@ public class TFM_AdminList
|
|||
};
|
||||
}
|
||||
|
||||
private TFM_AdminList()
|
||||
private AdminList()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@ -84,7 +83,7 @@ public class TFM_AdminList
|
|||
return Collections.unmodifiableSet(superIps);
|
||||
}
|
||||
|
||||
public static Set<TFM_Admin> getAllAdmins()
|
||||
public static Set<Admin> getAllAdmins()
|
||||
{
|
||||
return Sets.newHashSet(adminList.values());
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ public class TFM_AdminList
|
|||
{
|
||||
final Set<String> names = new HashSet<String>();
|
||||
|
||||
for (TFM_Admin admin : adminList.values())
|
||||
for (Admin admin : adminList.values())
|
||||
{
|
||||
if (!admin.isActivated())
|
||||
{
|
||||
|
@ -110,7 +109,7 @@ public class TFM_AdminList
|
|||
{
|
||||
final Set<String> names = new HashSet<String>();
|
||||
|
||||
for (TFM_Admin admin : adminList.values())
|
||||
for (Admin admin : adminList.values())
|
||||
{
|
||||
if (!admin.isActivated())
|
||||
{
|
||||
|
@ -123,22 +122,22 @@ public class TFM_AdminList
|
|||
return Collections.unmodifiableSet(names);
|
||||
}
|
||||
|
||||
public static void setUuid(TFM_Admin admin, UUID oldUuid, UUID newUuid)
|
||||
public static void setUuid(Admin admin, UUID oldUuid, UUID newUuid)
|
||||
{
|
||||
if (!adminList.containsKey(oldUuid))
|
||||
{
|
||||
TFM_Log.warning("Could not set new UUID for admin " + admin.getLastLoginName() + ", admin is not loaded!");
|
||||
Log.warning("Could not set new UUID for admin " + admin.getLastLoginName() + ", admin is not loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (oldUuid.equals(newUuid))
|
||||
{
|
||||
TFM_Log.warning("could not set new UUID for admin " + admin.getLastLoginName() + ", UUIDs match.");
|
||||
Log.warning("could not set new UUID for admin " + admin.getLastLoginName() + ", UUIDs match.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add new entry
|
||||
final TFM_Admin newAdmin = new TFM_Admin(
|
||||
final Admin newAdmin = new Admin(
|
||||
newUuid,
|
||||
admin.getLastLoginName(),
|
||||
admin.getLastLogin(),
|
||||
|
@ -152,7 +151,7 @@ public class TFM_AdminList
|
|||
|
||||
// Remove old entry
|
||||
adminList.remove(oldUuid);
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
config.load();
|
||||
config.set("admins." + oldUuid.toString(), null);
|
||||
config.save();
|
||||
|
@ -162,7 +161,7 @@ public class TFM_AdminList
|
|||
{
|
||||
adminList.clear();
|
||||
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
config.load();
|
||||
|
||||
cleanThreshold = config.getInt("clean_threshold_hours", cleanThreshold);
|
||||
|
@ -175,7 +174,7 @@ public class TFM_AdminList
|
|||
|
||||
if (!config.isConfigurationSection("admins"))
|
||||
{
|
||||
TFM_Log.warning("Missing admins section in superadmin.yml.");
|
||||
Log.warning("Missing admins section in superadmin.yml.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,21 +182,21 @@ public class TFM_AdminList
|
|||
|
||||
for (String uuidString : section.getKeys(false))
|
||||
{
|
||||
if (!TFM_Util.isUniqueId(uuidString))
|
||||
if (!Utilities.isUniqueId(uuidString))
|
||||
{
|
||||
TFM_Log.warning("Invalid Unique ID: " + uuidString + " in superadmin.yml, ignoring");
|
||||
Log.warning("Invalid Unique ID: " + uuidString + " in superadmin.yml, ignoring");
|
||||
continue;
|
||||
}
|
||||
|
||||
final UUID uuid = UUID.fromString(uuidString);
|
||||
|
||||
final TFM_Admin superadmin = new TFM_Admin(uuid, section.getConfigurationSection(uuidString));
|
||||
final Admin superadmin = new Admin(uuid, section.getConfigurationSection(uuidString));
|
||||
adminList.put(uuid, superadmin);
|
||||
}
|
||||
|
||||
updateIndexLists();
|
||||
|
||||
TFM_Log.info("Loaded " + adminList.size() + " admins (" + superUUIDs.size() + " active) and " + superIps.size() + " IPs.");
|
||||
Log.info("Loaded " + adminList.size() + " admins (" + superUUIDs.size() + " active) and " + superIps.size() + " IPs.");
|
||||
}
|
||||
|
||||
public static void updateIndexLists()
|
||||
|
@ -208,7 +207,7 @@ public class TFM_AdminList
|
|||
seniorConsoleNames.clear();
|
||||
superIps.clear();
|
||||
|
||||
for (TFM_Admin admin : adminList.values())
|
||||
for (Admin admin : adminList.values())
|
||||
{
|
||||
if (!admin.isActivated())
|
||||
{
|
||||
|
@ -241,12 +240,12 @@ public class TFM_AdminList
|
|||
}
|
||||
}
|
||||
|
||||
TFM_AdminWorld.getInstance().wipeAccessCache();
|
||||
AdminWorld.getInstance().wipeAccessCache();
|
||||
}
|
||||
|
||||
private static void parseOldConfig(TFM_Config config)
|
||||
private static void parseOldConfig(Configuration config)
|
||||
{
|
||||
TFM_Log.info("Old superadmin configuration found, parsing...");
|
||||
Log.info("Old superadmin configuration found, parsing...");
|
||||
|
||||
final ConfigurationSection section = config.getConfigurationSection("superadmins");
|
||||
|
||||
|
@ -255,12 +254,12 @@ public class TFM_AdminList
|
|||
|
||||
for (String admin : config.getConfigurationSection("superadmins").getKeys(false))
|
||||
{
|
||||
final UUID uuid = TFM_UuidManager.getUniqueId(admin);
|
||||
final UUID uuid = UUIDManager.getUniqueId(admin);
|
||||
|
||||
if (uuid == null)
|
||||
{
|
||||
errors++;
|
||||
TFM_Log.warning("Could not convert admin " + admin + ", UUID could not be found!");
|
||||
Log.warning("Could not convert admin " + admin + ", UUID could not be found!");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -279,46 +278,46 @@ public class TFM_AdminList
|
|||
config.set("superadmins", null);
|
||||
config.save();
|
||||
|
||||
TFM_Log.info("Done! " + counter + " admins parsed, " + errors + " errors");
|
||||
Log.info("Done! " + counter + " admins parsed, " + errors + " errors");
|
||||
}
|
||||
|
||||
public static void saveAll()
|
||||
{
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
config.load();
|
||||
|
||||
config.set("clean_threshold_hours", cleanThreshold);
|
||||
|
||||
final Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
final Iterator<Entry<UUID, Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Entry<UUID, TFM_Admin> pair = it.next();
|
||||
final Entry<UUID, Admin> pair = it.next();
|
||||
|
||||
final UUID uuid = pair.getKey();
|
||||
final TFM_Admin superadmin = pair.getValue();
|
||||
final Admin superadmin = pair.getValue();
|
||||
|
||||
config.set("admins." + uuid + ".last_login_name", superadmin.getLastLoginName());
|
||||
config.set("admins." + uuid + ".is_activated", superadmin.isActivated());
|
||||
config.set("admins." + uuid + ".is_telnet_admin", superadmin.isTelnetAdmin());
|
||||
config.set("admins." + uuid + ".is_senior_admin", superadmin.isSeniorAdmin());
|
||||
config.set("admins." + uuid + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
||||
config.set("admins." + uuid + ".last_login", Utilities.dateToString(superadmin.getLastLogin()));
|
||||
config.set("admins." + uuid + ".custom_login_message", superadmin.getCustomLoginMessage());
|
||||
config.set("admins." + uuid + ".console_aliases", TFM_Util.removeDuplicates(superadmin.getConsoleAliases()));
|
||||
config.set("admins." + uuid + ".ips", TFM_Util.removeDuplicates(superadmin.getIps()));
|
||||
config.set("admins." + uuid + ".console_aliases", Utilities.removeDuplicates(superadmin.getConsoleAliases()));
|
||||
config.set("admins." + uuid + ".ips", Utilities.removeDuplicates(superadmin.getIps()));
|
||||
}
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void save(TFM_Admin admin)
|
||||
public static void save(Admin admin)
|
||||
{
|
||||
if (!adminList.containsValue(admin))
|
||||
{
|
||||
TFM_Log.warning("Could not save admin " + admin.getLastLoginName() + ", admin is not loaded!");
|
||||
Log.warning("Could not save admin " + admin.getLastLoginName() + ", admin is not loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
|
||||
config.load();
|
||||
|
||||
final UUID uuid = admin.getUniqueId();
|
||||
|
@ -327,26 +326,26 @@ public class TFM_AdminList
|
|||
config.set("admins." + uuid + ".is_activated", admin.isActivated());
|
||||
config.set("admins." + uuid + ".is_telnet_admin", admin.isTelnetAdmin());
|
||||
config.set("admins." + uuid + ".is_senior_admin", admin.isSeniorAdmin());
|
||||
config.set("admins." + uuid + ".last_login", TFM_Util.dateToString(admin.getLastLogin()));
|
||||
config.set("admins." + uuid + ".last_login", Utilities.dateToString(admin.getLastLogin()));
|
||||
config.set("admins." + uuid + ".custom_login_message", admin.getCustomLoginMessage());
|
||||
config.set("admins." + uuid + ".console_aliases", TFM_Util.removeDuplicates(admin.getConsoleAliases()));
|
||||
config.set("admins." + uuid + ".ips", TFM_Util.removeDuplicates(admin.getIps()));
|
||||
config.set("admins." + uuid + ".console_aliases", Utilities.removeDuplicates(admin.getConsoleAliases()));
|
||||
config.set("admins." + uuid + ".ips", Utilities.removeDuplicates(admin.getIps()));
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static TFM_Admin getEntry(Player player)
|
||||
public static Admin getEntry(Player player)
|
||||
{
|
||||
return getEntry(TFM_UuidManager.getUniqueId(player));
|
||||
return getEntry(UUIDManager.getUniqueId(player));
|
||||
}
|
||||
|
||||
public static TFM_Admin getEntry(UUID uuid)
|
||||
public static Admin getEntry(UUID uuid)
|
||||
{
|
||||
return adminList.get(uuid);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static TFM_Admin getEntry(String name)
|
||||
public static Admin getEntry(String name)
|
||||
{
|
||||
for (UUID uuid : adminList.keySet())
|
||||
{
|
||||
|
@ -358,24 +357,24 @@ public class TFM_AdminList
|
|||
return null;
|
||||
}
|
||||
|
||||
public static TFM_Admin getEntryByIp(String ip)
|
||||
public static Admin getEntryByIp(String ip)
|
||||
{
|
||||
return getEntryByIp(ip, false);
|
||||
}
|
||||
|
||||
public static TFM_Admin getEntryByIp(String needleIp, boolean fuzzy)
|
||||
public static Admin getEntryByIp(String needleIp, boolean fuzzy)
|
||||
{
|
||||
Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
Iterator<Entry<UUID, Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Entry<UUID, TFM_Admin> pair = it.next();
|
||||
final TFM_Admin superadmin = pair.getValue();
|
||||
final Entry<UUID, Admin> pair = it.next();
|
||||
final Admin superadmin = pair.getValue();
|
||||
|
||||
if (fuzzy)
|
||||
{
|
||||
for (String haystackIp : superadmin.getIps())
|
||||
{
|
||||
if (TFM_Util.fuzzyIpMatch(needleIp, haystackIp, 3))
|
||||
if (Utilities.fuzzyIpMatch(needleIp, haystackIp, 3))
|
||||
{
|
||||
return superadmin;
|
||||
}
|
||||
|
@ -394,7 +393,7 @@ public class TFM_AdminList
|
|||
|
||||
public static void updateLastLogin(Player player)
|
||||
{
|
||||
final TFM_Admin admin = getEntry(player);
|
||||
final Admin admin = getEntry(player);
|
||||
if (admin == null)
|
||||
{
|
||||
return;
|
||||
|
@ -408,10 +407,10 @@ public class TFM_AdminList
|
|||
{
|
||||
if (TotalFreedomMod.server.getOnlineMode() && uuid != null)
|
||||
{
|
||||
return TFM_AdminList.getSuperUUIDs().contains(uuid);
|
||||
return AdminList.getSuperUUIDs().contains(uuid);
|
||||
}
|
||||
|
||||
final TFM_Admin admin = TFM_AdminList.getEntryByIp(ip);
|
||||
final Admin admin = AdminList.getEntryByIp(ip);
|
||||
return admin != null && admin.isActivated();
|
||||
}
|
||||
|
||||
|
@ -429,12 +428,12 @@ public class TFM_AdminList
|
|||
|
||||
final Player player = (Player) sender;
|
||||
|
||||
if (superIps.contains(TFM_Util.getIp(player)))
|
||||
if (superIps.contains(Utilities.getIp(player)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Bukkit.getOnlineMode() && superUUIDs.contains(TFM_UuidManager.getUniqueId(player)))
|
||||
if (Bukkit.getOnlineMode() && superUUIDs.contains(UUIDManager.getUniqueId(player)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -457,7 +456,7 @@ public class TFM_AdminList
|
|||
return true;
|
||||
}
|
||||
|
||||
final TFM_Admin entry = getEntry((Player) sender);
|
||||
final Admin entry = getEntry((Player) sender);
|
||||
if (entry != null)
|
||||
{
|
||||
return entry.isTelnetAdmin();
|
||||
|
@ -484,10 +483,10 @@ public class TFM_AdminList
|
|||
if (!(sender instanceof Player))
|
||||
{
|
||||
return seniorConsoleNames.contains(sender.getName())
|
||||
|| (TFM_MainConfig.getBoolean(TFM_ConfigEntry.CONSOLE_IS_SENIOR) && sender.getName().equals("CONSOLE"));
|
||||
|| (MainConfig.getBoolean(ConfigurationEntry.CONSOLE_IS_SENIOR) && sender.getName().equals("CONSOLE"));
|
||||
}
|
||||
|
||||
final TFM_Admin entry = getEntry((Player) sender);
|
||||
final Admin entry = getEntry((Player) sender);
|
||||
if (entry != null)
|
||||
{
|
||||
return entry.isSeniorAdmin();
|
||||
|
@ -508,13 +507,13 @@ public class TFM_AdminList
|
|||
return true;
|
||||
}
|
||||
|
||||
final TFM_Admin entry = getEntry(player);
|
||||
final Admin entry = getEntry(player);
|
||||
if (entry == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return entry.getUniqueId().equals(TFM_UuidManager.getUniqueId(player));
|
||||
return entry.getUniqueId().equals(UUIDManager.getUniqueId(player));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -532,7 +531,7 @@ public class TFM_AdminList
|
|||
String matchIp = null;
|
||||
for (String testIp : superIps)
|
||||
{
|
||||
if (TFM_Util.fuzzyIpMatch(ip, testIp, 3))
|
||||
if (Utilities.fuzzyIpMatch(ip, testIp, 3))
|
||||
{
|
||||
matchIp = testIp;
|
||||
break;
|
||||
|
@ -541,7 +540,7 @@ public class TFM_AdminList
|
|||
|
||||
if (matchIp != null)
|
||||
{
|
||||
final TFM_Admin entry = getEntryByIp(matchIp);
|
||||
final Admin entry = getEntryByIp(matchIp);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
|
@ -562,7 +561,7 @@ public class TFM_AdminList
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -570,7 +569,7 @@ public class TFM_AdminList
|
|||
|
||||
public static boolean isAdminImpostor(Player player)
|
||||
{
|
||||
if (superUUIDs.contains(TFM_UuidManager.getUniqueId(player)))
|
||||
if (superUUIDs.contains(UUIDManager.getUniqueId(player)))
|
||||
{
|
||||
return !isSuperAdmin(player);
|
||||
}
|
||||
|
@ -580,13 +579,13 @@ public class TFM_AdminList
|
|||
|
||||
public static void addSuperadmin(OfflinePlayer player)
|
||||
{
|
||||
final UUID uuid = TFM_UuidManager.getUniqueId(player);
|
||||
final String ip = TFM_Util.getIp(player);
|
||||
final boolean canSuperIp = !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip);
|
||||
final UUID uuid = UUIDManager.getUniqueId(player);
|
||||
final String ip = Utilities.getIp(player);
|
||||
final boolean canSuperIp = !MainConfig.getList(ConfigurationEntry.NOADMIN_IPS).contains(ip);
|
||||
|
||||
if (adminList.containsKey(uuid))
|
||||
{
|
||||
final TFM_Admin superadmin = adminList.get(uuid);
|
||||
final Admin superadmin = adminList.get(uuid);
|
||||
superadmin.setActivated(true);
|
||||
|
||||
if (player.isOnline())
|
||||
|
@ -606,19 +605,19 @@ public class TFM_AdminList
|
|||
|
||||
if (ip == null)
|
||||
{
|
||||
TFM_Log.severe("Could not add superadmin: " + TFM_Util.formatPlayer(player));
|
||||
TFM_Log.severe("Could not retrieve IP!");
|
||||
Log.severe("Could not add superadmin: " + Utilities.formatPlayer(player));
|
||||
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.");
|
||||
Log.warning("Could not add superadmin: " + Utilities.formatPlayer(player));
|
||||
Log.warning("IP " + ip + " may not be supered.");
|
||||
return;
|
||||
}
|
||||
|
||||
final TFM_Admin superadmin = new TFM_Admin(
|
||||
final Admin superadmin = new Admin(
|
||||
uuid,
|
||||
player.getName(),
|
||||
new Date(),
|
||||
|
@ -636,16 +635,16 @@ public class TFM_AdminList
|
|||
|
||||
public static void removeSuperadmin(OfflinePlayer player)
|
||||
{
|
||||
final UUID uuid = TFM_UuidManager.getUniqueId(player);
|
||||
final UUID uuid = UUIDManager.getUniqueId(player);
|
||||
|
||||
if (!adminList.containsKey(uuid))
|
||||
{
|
||||
TFM_Log.warning("Could not remove admin: " + TFM_Util.formatPlayer(player));
|
||||
TFM_Log.warning("Player is not an admin!");
|
||||
Log.warning("Could not remove admin: " + Utilities.formatPlayer(player));
|
||||
Log.warning("Player is not an admin!");
|
||||
return;
|
||||
}
|
||||
|
||||
final TFM_Admin superadmin = adminList.get(uuid);
|
||||
final Admin superadmin = adminList.get(uuid);
|
||||
superadmin.setActivated(false);
|
||||
Command_logs.deactivateSuperadmin(superadmin);
|
||||
|
||||
|
@ -655,11 +654,11 @@ public class TFM_AdminList
|
|||
|
||||
public static void cleanSuperadminList(boolean verbose)
|
||||
{
|
||||
Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
Iterator<Entry<UUID, Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Entry<UUID, TFM_Admin> pair = it.next();
|
||||
final TFM_Admin superadmin = pair.getValue();
|
||||
final Entry<UUID, Admin> pair = it.next();
|
||||
final Admin superadmin = pair.getValue();
|
||||
|
||||
if (!superadmin.isActivated() || superadmin.isSeniorAdmin())
|
||||
{
|
||||
|
@ -673,12 +672,12 @@ public class TFM_AdminList
|
|||
{
|
||||
if (verbose)
|
||||
{
|
||||
TFM_Util.adminAction("TotalFreedomMod", "Deactivating superadmin " + superadmin.getLastLoginName() + ", inactive for " + lastLoginHours + " hours.", true);
|
||||
Utilities.adminAction("TotalFreedomMod", "Deactivating superadmin " + superadmin.getLastLoginName() + ", inactive for " + lastLoginHours + " hours.", true);
|
||||
}
|
||||
|
||||
superadmin.setActivated(false);
|
||||
Command_logs.deactivateSuperadmin(superadmin);
|
||||
TFM_TwitterHandler.delTwitter(superadmin.getLastLoginName());
|
||||
TwitterHandler.delTwitter(superadmin.getLastLoginName());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.announcer;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class TFM_Announcer
|
||||
public class Announcer
|
||||
{
|
||||
private static final List<String> ANNOUNCEMENTS = new ArrayList<String>();
|
||||
private static boolean enabled;
|
||||
|
@ -14,7 +17,7 @@ public class TFM_Announcer
|
|||
private static String prefix;
|
||||
private static BukkitRunnable announcer;
|
||||
|
||||
private TFM_Announcer()
|
||||
private Announcer()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@ -45,14 +48,14 @@ public class TFM_Announcer
|
|||
|
||||
ANNOUNCEMENTS.clear();
|
||||
|
||||
for (Object announcement : TFM_ConfigEntry.ANNOUNCER_ANNOUNCEMENTS.getList())
|
||||
for (Object announcement : ConfigurationEntry.ANNOUNCER_ANNOUNCEMENTS.getList())
|
||||
{
|
||||
ANNOUNCEMENTS.add(TFM_Util.colorize((String) announcement));
|
||||
ANNOUNCEMENTS.add(Utilities.colorize((String) announcement));
|
||||
}
|
||||
|
||||
enabled = TFM_ConfigEntry.ANNOUNCER_ENABLED.getBoolean();
|
||||
interval = TFM_ConfigEntry.ANNOUNCER_INTERVAL.getInteger() * 20L;
|
||||
prefix = TFM_Util.colorize(TFM_ConfigEntry.ANNOUNCER_PREFIX.getString());
|
||||
enabled = ConfigurationEntry.ANNOUNCER_ENABLED.getBoolean();
|
||||
interval = ConfigurationEntry.ANNOUNCER_INTERVAL.getInteger() * 20L;
|
||||
prefix = Utilities.colorize(ConfigurationEntry.ANNOUNCER_PREFIX.getString());
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
|
@ -86,7 +89,7 @@ public class TFM_Announcer
|
|||
current = 0;
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(prefix + ANNOUNCEMENTS.get(current));
|
||||
Utilities.bcastMsg(prefix + ANNOUNCEMENTS.get(current));
|
||||
}
|
||||
};
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.ban;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class TFM_Ban
|
||||
public class Ban
|
||||
{
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||
public static final Pattern IP_BAN_REGEX;
|
||||
|
@ -40,38 +42,38 @@ public class TFM_Ban
|
|||
private long expireUnix;
|
||||
private String reason;
|
||||
|
||||
public TFM_Ban(String ip, String lastLoginName)
|
||||
public Ban(String ip, String lastLoginName)
|
||||
{
|
||||
this(ip, lastLoginName, null, null, null);
|
||||
}
|
||||
|
||||
public TFM_Ban(String ip, String lastLoginName, String sender, Date expire, String reason)
|
||||
public Ban(String ip, String lastLoginName, String sender, Date expire, String reason)
|
||||
{
|
||||
this(ip, lastLoginName, sender, expire, reason, BanType.IP);
|
||||
}
|
||||
|
||||
public TFM_Ban(UUID uuid, String lastLoginName)
|
||||
public Ban(UUID uuid, String lastLoginName)
|
||||
{
|
||||
this(uuid, lastLoginName, null, null, null);
|
||||
}
|
||||
|
||||
public TFM_Ban(UUID uuid, String lastLoginName, String sender, Date expire, String reason)
|
||||
public Ban(UUID uuid, String lastLoginName, String sender, Date expire, String reason)
|
||||
{
|
||||
this(uuid.toString(), lastLoginName, sender, expire, reason, BanType.UUID);
|
||||
}
|
||||
|
||||
private TFM_Ban(String subject, String lastLoginName, String sender, Date expire, String reason, BanType type)
|
||||
private Ban(String subject, String lastLoginName, String sender, Date expire, String reason, BanType type)
|
||||
{
|
||||
this.type = type;
|
||||
this.subject = subject;
|
||||
this.lastLoginName = (lastLoginName == null ? "none" : lastLoginName);
|
||||
this.by = (sender == null ? "none" : sender);
|
||||
this.expireUnix = (expire == null ? 0 : TFM_Util.getUnixTime(expire));
|
||||
this.expireUnix = (expire == null ? 0 : Utilities.getUnixTime(expire));
|
||||
this.reason = (reason == null ? "none" : reason);
|
||||
complete = true;
|
||||
}
|
||||
|
||||
public TFM_Ban(String banString, BanType type)
|
||||
public Ban(String banString, BanType type)
|
||||
{
|
||||
this.type = type;
|
||||
|
||||
|
@ -87,7 +89,7 @@ public class TFM_Ban
|
|||
lastLoginName = matcher.group(2);
|
||||
by = matcher.group(3);
|
||||
expireUnix = Long.valueOf(matcher.group(4));
|
||||
reason = TFM_Util.colorize(matcher.group(5));
|
||||
reason = Utilities.colorize(matcher.group(5));
|
||||
complete = true;
|
||||
}
|
||||
|
||||
|
@ -129,7 +131,7 @@ public class TFM_Ban
|
|||
|
||||
public boolean isExpired()
|
||||
{
|
||||
return expireUnix != 0 && expireUnix < TFM_Util.getUnixTime();
|
||||
return expireUnix != 0 && expireUnix < Utilities.getUnixTime();
|
||||
}
|
||||
|
||||
public boolean isComplete()
|
||||
|
@ -142,7 +144,7 @@ public class TFM_Ban
|
|||
final StringBuilder message = new StringBuilder("You");
|
||||
|
||||
message.append(type == BanType.IP ? "r IP address is" : " are").append(" temporarily banned from this server.");
|
||||
message.append("\nAppeal at ").append(ChatColor.GOLD).append(TFM_ConfigEntry.SERVER_BAN_URL.getString());
|
||||
message.append("\nAppeal at ").append(ChatColor.GOLD).append(ConfigurationEntry.SERVER_BAN_URL.getString());
|
||||
|
||||
if (!reason.equals("none"))
|
||||
{
|
||||
|
@ -151,7 +153,7 @@ public class TFM_Ban
|
|||
|
||||
if (getExpireUnix() != 0)
|
||||
{
|
||||
message.append("\nYour ban will be removed on ").append(DATE_FORMAT.format(TFM_Util.getUnixDate(expireUnix)));
|
||||
message.append("\nYour ban will be removed on ").append(DATE_FORMAT.format(Utilities.getUnixDate(expireUnix)));
|
||||
}
|
||||
|
||||
return message.toString();
|
||||
|
@ -161,7 +163,7 @@ public class TFM_Ban
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return subject + ":" + lastLoginName + ":" + by + ":" + expireUnix + ":" + TFM_Util.decolorize(reason);
|
||||
return subject + ":" + lastLoginName + ":" + by + ":" + expireUnix + ":" + Utilities.decolorize(reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,12 +174,12 @@ public class TFM_Ban
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!(object instanceof TFM_Ban))
|
||||
if (!(object instanceof Ban))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final TFM_Ban ban = (TFM_Ban) object;
|
||||
final Ban ban = (Ban) object;
|
||||
|
||||
if (toString().equals(ban.toString()))
|
||||
{
|
|
@ -1,30 +1,31 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.ban;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban.BanType;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager.TFM_UuidResolver;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.Ban.BanType;
|
||||
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager.TFM_UuidResolver;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_BanManager
|
||||
import java.util.*;
|
||||
|
||||
public class BanManager
|
||||
{
|
||||
private static final List<TFM_Ban> ipBans;
|
||||
private static final List<TFM_Ban> uuidBans;
|
||||
private static final List<Ban> ipBans;
|
||||
private static final List<Ban> uuidBans;
|
||||
private static final List<UUID> unbannableUUIDs;
|
||||
|
||||
static
|
||||
{
|
||||
ipBans = new ArrayList<TFM_Ban>();
|
||||
uuidBans = new ArrayList<TFM_Ban>();
|
||||
ipBans = new ArrayList<Ban>();
|
||||
uuidBans = new ArrayList<Ban>();
|
||||
unbannableUUIDs = new ArrayList<UUID>();
|
||||
}
|
||||
|
||||
private TFM_BanManager()
|
||||
private BanManager()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@ -35,18 +36,18 @@ public class TFM_BanManager
|
|||
uuidBans.clear();
|
||||
unbannableUUIDs.clear();
|
||||
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, "bans.yml", true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, "bans.yml", true);
|
||||
config.load();
|
||||
|
||||
for (String banString : config.getStringList("ips"))
|
||||
{
|
||||
try
|
||||
{
|
||||
addIpBan(new TFM_Ban(banString, BanType.IP));
|
||||
addIpBan(new Ban(banString, BanType.IP));
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
TFM_Log.warning("Could not load IP ban: " + banString);
|
||||
Log.warning("Could not load IP ban: " + banString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,38 +55,38 @@ public class TFM_BanManager
|
|||
{
|
||||
try
|
||||
{
|
||||
addUuidBan(new TFM_Ban(banString, BanType.UUID));
|
||||
addUuidBan(new Ban(banString, BanType.UUID));
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
TFM_Log.warning("Could not load UUID ban: " + banString);
|
||||
Log.warning("Could not load UUID ban: " + banString);
|
||||
}
|
||||
}
|
||||
|
||||
// Save the config
|
||||
save();
|
||||
TFM_Log.info("Loaded " + ipBans.size() + " IP bans and " + uuidBans.size() + " UUID bans");
|
||||
Log.info("Loaded " + ipBans.size() + " IP bans and " + uuidBans.size() + " UUID bans");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final TFM_UuidResolver resolver = new TFM_UuidResolver((List<String>) TFM_ConfigEntry.UNBANNABLE_USERNAMES.getList());
|
||||
final TFM_UuidResolver resolver = new TFM_UuidResolver((List<String>) ConfigurationEntry.UNBANNABLE_USERNAMES.getList());
|
||||
|
||||
for (UUID uuid : resolver.call().values())
|
||||
{
|
||||
unbannableUUIDs.add(uuid);
|
||||
}
|
||||
|
||||
TFM_Log.info("Loaded " + unbannableUUIDs.size() + " unbannable UUIDs");
|
||||
Log.info("Loaded " + unbannableUUIDs.size() + " unbannable UUIDs");
|
||||
}
|
||||
|
||||
public static void save()
|
||||
{
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, "bans.yml", true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, "bans.yml", true);
|
||||
config.load();
|
||||
|
||||
final List<String> newIpBans = new ArrayList<String>();
|
||||
final List<String> newUuidBans = new ArrayList<String>();
|
||||
|
||||
for (TFM_Ban savedBan : ipBans)
|
||||
for (Ban savedBan : ipBans)
|
||||
{
|
||||
if (!savedBan.isExpired())
|
||||
{
|
||||
|
@ -93,7 +94,7 @@ public class TFM_BanManager
|
|||
}
|
||||
}
|
||||
|
||||
for (TFM_Ban savedBan : uuidBans)
|
||||
for (Ban savedBan : uuidBans)
|
||||
{
|
||||
if (!savedBan.isExpired() && !unbannableUUIDs.contains(UUID.fromString(savedBan.getSubject())))
|
||||
{
|
||||
|
@ -108,19 +109,19 @@ public class TFM_BanManager
|
|||
config.save();
|
||||
}
|
||||
|
||||
public static List<TFM_Ban> getIpBanList()
|
||||
public static List<Ban> getIpBanList()
|
||||
{
|
||||
return Collections.unmodifiableList(ipBans);
|
||||
}
|
||||
|
||||
public static List<TFM_Ban> getUuidBanList()
|
||||
public static List<Ban> getUuidBanList()
|
||||
{
|
||||
return Collections.unmodifiableList(uuidBans);
|
||||
}
|
||||
|
||||
public static TFM_Ban getByIp(String ip)
|
||||
public static Ban getByIp(String ip)
|
||||
{
|
||||
for (TFM_Ban ban : ipBans)
|
||||
for (Ban ban : ipBans)
|
||||
{
|
||||
if (ban.isExpired())
|
||||
{
|
||||
|
@ -152,9 +153,9 @@ public class TFM_BanManager
|
|||
return null;
|
||||
}
|
||||
|
||||
public static TFM_Ban getByUuid(UUID uuid)
|
||||
public static Ban getByUuid(UUID uuid)
|
||||
{
|
||||
for (TFM_Ban ban : uuidBans)
|
||||
for (Ban ban : uuidBans)
|
||||
{
|
||||
if (ban.getSubject().equalsIgnoreCase(uuid.toString()))
|
||||
{
|
||||
|
@ -171,7 +172,7 @@ public class TFM_BanManager
|
|||
|
||||
public static void unbanIp(String ip)
|
||||
{
|
||||
final TFM_Ban ban = getByIp(ip);
|
||||
final Ban ban = getByIp(ip);
|
||||
|
||||
if (ban == null)
|
||||
{
|
||||
|
@ -184,7 +185,7 @@ public class TFM_BanManager
|
|||
|
||||
public static void unbanUuid(UUID uuid)
|
||||
{
|
||||
final TFM_Ban ban = getByUuid(uuid);
|
||||
final Ban ban = getByUuid(uuid);
|
||||
|
||||
if (ban == null)
|
||||
{
|
||||
|
@ -206,10 +207,10 @@ public class TFM_BanManager
|
|||
|
||||
public static void addUuidBan(Player player)
|
||||
{
|
||||
addUuidBan(new TFM_Ban(TFM_UuidManager.getUniqueId(player), player.getName()));
|
||||
addUuidBan(new Ban(UUIDManager.getUniqueId(player), player.getName()));
|
||||
}
|
||||
|
||||
public static void addUuidBan(TFM_Ban ban)
|
||||
public static void addUuidBan(Ban ban)
|
||||
{
|
||||
if (!ban.isComplete())
|
||||
{
|
||||
|
@ -237,10 +238,10 @@ public class TFM_BanManager
|
|||
|
||||
public static void addIpBan(Player player)
|
||||
{
|
||||
addIpBan(new TFM_Ban(TFM_Util.getIp(player), player.getName()));
|
||||
addIpBan(new Ban(Utilities.getIp(player), player.getName()));
|
||||
}
|
||||
|
||||
public static void addIpBan(TFM_Ban ban)
|
||||
public static void addIpBan(Ban ban)
|
||||
{
|
||||
if (!ban.isComplete())
|
||||
{
|
||||
|
@ -261,9 +262,9 @@ public class TFM_BanManager
|
|||
save();
|
||||
}
|
||||
|
||||
public static void removeBan(TFM_Ban ban)
|
||||
public static void removeBan(Ban ban)
|
||||
{
|
||||
final Iterator<TFM_Ban> ips = ipBans.iterator();
|
||||
final Iterator<Ban> ips = ipBans.iterator();
|
||||
while (ips.hasNext())
|
||||
{
|
||||
if (ips.next().getSubject().equalsIgnoreCase(ban.getSubject()))
|
||||
|
@ -272,7 +273,7 @@ public class TFM_BanManager
|
|||
}
|
||||
}
|
||||
|
||||
final Iterator<TFM_Ban> uuids = uuidBans.iterator();
|
||||
final Iterator<Ban> uuids = uuidBans.iterator();
|
||||
while (uuids.hasNext())
|
||||
{
|
||||
if (uuids.next().getSubject().equalsIgnoreCase(ban.getSubject()))
|
|
@ -1,11 +1,14 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.ban;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.config.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
|
||||
public class TFM_PermbanList
|
||||
public class PermbanList
|
||||
{
|
||||
|
||||
private static final List<String> PERMBANNED_PLAYERS;
|
||||
|
@ -17,7 +20,7 @@ public class TFM_PermbanList
|
|||
PERMBANNED_IPS = new ArrayList<String>();
|
||||
}
|
||||
|
||||
private TFM_PermbanList()
|
||||
private PermbanList()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@ -37,7 +40,7 @@ public class TFM_PermbanList
|
|||
PERMBANNED_PLAYERS.clear();
|
||||
PERMBANNED_IPS.clear();
|
||||
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.PERMBAN_FILENAME, true);
|
||||
final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.PERMBAN_FILENAME, true);
|
||||
config.load();
|
||||
|
||||
for (String playername : config.getKeys(false))
|
||||
|
@ -55,6 +58,6 @@ public class TFM_PermbanList
|
|||
}
|
||||
}
|
||||
|
||||
TFM_Log.info("Loaded " + PERMBANNED_PLAYERS.size() + " permanently banned players and " + PERMBANNED_IPS.size() + " permanently banned IPs.");
|
||||
Log.info("Loaded " + PERMBANNED_PLAYERS.size() + " permanently banned players and " + PERMBANNED_IPS.size() + " permanently banned IPs.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
package me.StevenLawson.TotalFreedomMod.bridge;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerRank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.javacord.api.DiscordApi;
|
||||
import org.javacord.api.DiscordApiBuilder;
|
||||
import org.javacord.api.entity.channel.TextChannel;
|
||||
import org.javacord.api.entity.message.MessageAuthor;
|
||||
import org.javacord.api.entity.message.embed.EmbedBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class DiscordBridge {
|
||||
private static DiscordApi DISCORD_API;
|
||||
private static TextChannel CHANNEL;
|
||||
|
||||
public static void load() {
|
||||
|
||||
if (Boolean.FALSE.equals(MainConfig.getBoolean(ConfigurationEntry.DISCORD_IS_ENABLED))) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
DISCORD_API = new DiscordApiBuilder()
|
||||
.setToken(MainConfig.getString(ConfigurationEntry.DISCORD_TOKEN))
|
||||
.login()
|
||||
.join();
|
||||
|
||||
Optional<TextChannel> channelFuture = DISCORD_API.getTextChannelById(MainConfig.getString(ConfigurationEntry.DISCORD_CHANNEL));
|
||||
|
||||
if (!channelFuture.isPresent()) {
|
||||
Log.warning("TFM 4.3 Reloaded could not find your channel, stopping!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CHANNEL = channelFuture.get();
|
||||
|
||||
CHANNEL.addMessageCreateListener((message) -> {
|
||||
String content = message.getMessageContent();
|
||||
MessageAuthor author = message.getMessage().getAuthor();
|
||||
if (author.isBotUser() || content.isEmpty()) return;
|
||||
|
||||
if (content.equalsIgnoreCase(String.format("%sl", MainConfig.getString(ConfigurationEntry.DISCORD_PREFIX)))) {
|
||||
// TODO: Make this shitty code better (I was very tired from a blood test whilst writing this)
|
||||
|
||||
EmbedBuilder builder = new EmbedBuilder()
|
||||
.setTitle(String.format("Player List - %s", MainConfig.getString(ConfigurationEntry.SERVER_NAME)))
|
||||
.setDescription(String.format("There are %s / %s online players", Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers()));
|
||||
ArrayList<String> seniorAdmins = new ArrayList<>();
|
||||
ArrayList<String> developers = new ArrayList<>();
|
||||
ArrayList<String> impostors = new ArrayList<>();
|
||||
ArrayList<String> deopped = new ArrayList<>();
|
||||
ArrayList<String> operators = new ArrayList<>();
|
||||
ArrayList<String> superAdmins = new ArrayList<>();
|
||||
ArrayList<String> superTelnetAdmins = new ArrayList<>();
|
||||
ArrayList<String> owners = new ArrayList<>();
|
||||
|
||||
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) {
|
||||
PlayerRank rank = PlayerRank.fromSender(player);
|
||||
|
||||
if (EssentialsBridge.getEssentialsUser(player.getName()).isVanished()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rank.equals(PlayerRank.IMPOSTOR)) {
|
||||
impostors.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.DEVELOPER)) {
|
||||
developers.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.NON_OP)) {
|
||||
deopped.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.SENIOR)) {
|
||||
seniorAdmins.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.OWNER)) {
|
||||
owners.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.OP)) {
|
||||
operators.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.SUPER)) {
|
||||
superAdmins.add(player.getName());
|
||||
} else if (rank.equals(PlayerRank.TELNET)) {
|
||||
superTelnetAdmins.add(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (owners.size() > 0) {
|
||||
builder.addField(String.format("Owners (%s)", owners.size()), String.join(", ", owners));
|
||||
}
|
||||
|
||||
if (seniorAdmins.size() > 0) {
|
||||
builder.addField(String.format("Senior Admins (%s)", seniorAdmins.size()), String.join(", ", seniorAdmins));
|
||||
}
|
||||
|
||||
if (developers.size() > 0) {
|
||||
builder.addField(String.format("Developers (%s)", developers.size()), String.join(", ", developers));
|
||||
}
|
||||
|
||||
if (superTelnetAdmins.size() > 0) {
|
||||
builder.addField(String.format("Super Telnet Admins (%s)", superTelnetAdmins.size()), String.join(", ", superTelnetAdmins));
|
||||
}
|
||||
|
||||
if (superAdmins.size() > 0) {
|
||||
builder.addField(String.format("Super Admins (%s)", superAdmins.size()), String.join(", ", seniorAdmins));
|
||||
}
|
||||
|
||||
if (operators.size() > 0) {
|
||||
builder.addField(String.format("Operators (%s)", operators.size()), String.join(", ", operators));
|
||||
}
|
||||
|
||||
if (deopped.size() > 0) {
|
||||
builder.addField(String.format("Non-Operators (%s)", deopped.size()), String.join(", ", deopped));
|
||||
}
|
||||
|
||||
if (impostors.size() > 0) {
|
||||
builder.addField(String.format("Impostors (%s)", impostors.size()), String.join(", ", impostors));
|
||||
}
|
||||
|
||||
CHANNEL.sendMessage(builder);
|
||||
} else {
|
||||
String format = MainConfig.getString(ConfigurationEntry.DISCORD_FORMAT);
|
||||
format = format.replace("{TAG}", author.getDiscriminatedName());
|
||||
format = format.replace("{USERNAME}", author.getName());
|
||||
|
||||
Bukkit.broadcastMessage(String.format(format, content));
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.warning("Uh oh! It looks like TFM 4.3 Reloaded Discord couldn't start! Please check you have defined the bot's token & channel and also given it the correct permissions! (Read Messages and Send Messages)");
|
||||
Log.warning("If you've already set that up however, you may to read the exception below.");
|
||||
Log.warning("If this is a bug with TFM 4.3 Reloaded, please report it at https://github.com/TheDeus-Group/TFM-4.3-Reloaded/issues or https://code.cat.casa/TheDeus-Group/TFM-4.3-Reloaded/issues");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.info("TFM 4.3 Reloaded Discord started.");
|
||||
|
||||
transmitMessage("**Server has started**");
|
||||
}
|
||||
|
||||
public static String sanitizeMessage(String message) {
|
||||
Pattern colors = Pattern.compile("§.", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||
Pattern pings = Pattern.compile("@", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||
|
||||
if (message.length() > 2000) {
|
||||
message = message.substring(0, 2000);
|
||||
}
|
||||
|
||||
return message.replaceAll(colors.pattern(), "").replaceAll(pings.pattern(), "@\u200B");
|
||||
}
|
||||
|
||||
public static void transmitMessage(String message) {
|
||||
transmitMessage(message, false);
|
||||
}
|
||||
|
||||
public static void transmitMessage(String message, boolean disconnectAfterwards) {
|
||||
if (CHANNEL == null) return;
|
||||
if (!disconnectAfterwards) {
|
||||
CHANNEL.sendMessage(sanitizeMessage(message));
|
||||
} else {
|
||||
try {
|
||||
CHANNEL.sendMessage(sanitizeMessage(message)).get();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
DISCORD_API.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public static void stop() {
|
||||
|
||||
if (Boolean.FALSE.equals(MainConfig.getBoolean(ConfigurationEntry.DISCORD_IS_ENABLED))) {
|
||||
return;
|
||||
}
|
||||
|
||||
transmitMessage("**Server has stopped**", true);
|
||||
|
||||
Log.info("TFM 4.3 Reloaded Discord stopped.");
|
||||
}
|
||||
}
|
|
@ -1,23 +1,20 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
package me.StevenLawson.TotalFreedomMod.bridge;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class TFM_EssentialsBridge
|
||||
{
|
||||
public class EssentialsBridge {
|
||||
private static Essentials essentialsPlugin = null;
|
||||
|
||||
private TFM_EssentialsBridge()
|
||||
{
|
||||
private EssentialsBridge() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static Essentials getEssentialsPlugin()
|
||||
{
|
||||
public static Essentials getEssentialsPlugin() {
|
||||
if (essentialsPlugin == null)
|
||||
{
|
||||
try
|
||||
|
@ -33,7 +30,7 @@ public class TFM_EssentialsBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
return essentialsPlugin;
|
||||
|
@ -51,7 +48,7 @@ public class TFM_EssentialsBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -69,7 +66,7 @@ public class TFM_EssentialsBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +82,7 @@ public class TFM_EssentialsBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -97,12 +94,12 @@ public class TFM_EssentialsBridge
|
|||
final User user = getEssentialsUser(username);
|
||||
if (user != null)
|
||||
{
|
||||
return TFM_Util.<Long>getField(user, "lastActivity"); // This is weird
|
||||
return Utilities.<Long>getField(user, "lastActivity"); // This is weird
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
@ -119,7 +116,7 @@ public class TFM_EssentialsBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -1,24 +1,21 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
package me.StevenLawson.TotalFreedomMod.bridge;
|
||||
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class TFM_WorldEditBridge
|
||||
{
|
||||
public class WorldEditBridge {
|
||||
private static WorldEditPlugin worldEditPlugin = null;
|
||||
|
||||
private TFM_WorldEditBridge()
|
||||
{
|
||||
private WorldEditBridge() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
private static WorldEditPlugin getWorldEditPlugin()
|
||||
{
|
||||
private static WorldEditPlugin getWorldEditPlugin() {
|
||||
if (worldEditPlugin == null)
|
||||
{
|
||||
try
|
||||
|
@ -34,7 +31,7 @@ public class TFM_WorldEditBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
return worldEditPlugin;
|
||||
|
@ -52,7 +49,7 @@ public class TFM_WorldEditBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -69,7 +66,7 @@ public class TFM_WorldEditBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -93,7 +90,7 @@ public class TFM_WorldEditBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +106,7 @@ public class TFM_WorldEditBridge
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.command;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.commands.CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -12,7 +12,11 @@ import org.bukkit.command.CommandMap;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_CommandBlocker
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CommandBlocker
|
||||
{
|
||||
private static final Map<String, CommandBlockerEntry> BLOCKED_COMMANDS;
|
||||
|
||||
|
@ -21,7 +25,7 @@ public class TFM_CommandBlocker
|
|||
BLOCKED_COMMANDS = new HashMap<String, CommandBlockerEntry>();
|
||||
}
|
||||
|
||||
private TFM_CommandBlocker()
|
||||
private CommandBlocker()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@ -30,21 +34,21 @@ public class TFM_CommandBlocker
|
|||
{
|
||||
BLOCKED_COMMANDS.clear();
|
||||
|
||||
final CommandMap commandMap = TFM_CommandLoader.getCommandMap();
|
||||
final CommandMap commandMap = CommandLoader.getCommandMap();
|
||||
if (commandMap == null)
|
||||
{
|
||||
TFM_Log.severe("Error loading commandMap.");
|
||||
Log.severe("Error loading commandMap.");
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> blockedCommands = (List<String>) TFM_ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||
List<String> blockedCommands = (List<String>) ConfigurationEntry.BLOCKED_COMMANDS.getList();
|
||||
for (String rawEntry : blockedCommands)
|
||||
{
|
||||
final String[] parts = rawEntry.split(":");
|
||||
if (parts.length < 3 || parts.length > 4)
|
||||
{
|
||||
TFM_Log.warning("Invalid command blocker entry: " + rawEntry);
|
||||
Log.warning("Invalid command blocker entry: " + rawEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -55,7 +59,7 @@ public class TFM_CommandBlocker
|
|||
|
||||
if (rank == null || action == null || commandName == null || commandName.isEmpty())
|
||||
{
|
||||
TFM_Log.warning("Invalid command blocker entry: " + rawEntry);
|
||||
Log.warning("Invalid command blocker entry: " + rawEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -72,7 +76,7 @@ public class TFM_CommandBlocker
|
|||
// Obtain command from alias
|
||||
if (command == null)
|
||||
{
|
||||
TFM_Log.info("Blocking unknown command: /" + commandName);
|
||||
Log.info("Blocking unknown command: /" + commandName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -81,7 +85,7 @@ public class TFM_CommandBlocker
|
|||
|
||||
if (BLOCKED_COMMANDS.containsKey(commandName))
|
||||
{
|
||||
TFM_Log.warning("Not blocking: /" + commandName + " - Duplicate entry exists!");
|
||||
Log.warning("Not blocking: /" + commandName + " - Duplicate entry exists!");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -97,7 +101,7 @@ public class TFM_CommandBlocker
|
|||
}
|
||||
}
|
||||
|
||||
TFM_Log.info("Loaded " + BLOCKED_COMMANDS.size() + " blocked commands");
|
||||
Log.info("Loaded " + BLOCKED_COMMANDS.size() + " blocked commands");
|
||||
}
|
||||
|
||||
public static boolean isCommandBlocked(String command, CommandSender sender)
|
||||
|
@ -116,7 +120,7 @@ public class TFM_CommandBlocker
|
|||
|
||||
if (command.split(" ")[0].contains(":"))
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Plugin-specific commands are disabled.");
|
||||
Utilities.playerMsg(sender, "Plugin-specific commands are disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -195,9 +199,9 @@ public class TFM_CommandBlocker
|
|||
return TELNET;
|
||||
}
|
||||
|
||||
if (TFM_AdminList.isSuperAdmin(sender))
|
||||
if (AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
if (TFM_AdminList.isSeniorAdmin(sender))
|
||||
if (AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
return SENIOR;
|
||||
}
|
||||
|
@ -307,18 +311,18 @@ public class TFM_CommandBlocker
|
|||
{
|
||||
if (action == CommandBlockerAction.BLOCK_AND_EJECT && sender instanceof Player)
|
||||
{
|
||||
TFM_Util.autoEject((Player) sender, "You used a prohibited command: " + command);
|
||||
TFM_Util.bcastMsg(sender.getName() + " was automatically kicked for using harmful commands.", ChatColor.RED);
|
||||
Utilities.autoEject((Player) sender, "You used a prohibited command: " + command);
|
||||
Utilities.bcastMsg(sender.getName() + " was automatically kicked for using harmful commands.", ChatColor.RED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == CommandBlockerAction.BLOCK_UNKNOWN)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Unknown command. Type \"help\" for help.", ChatColor.RESET);
|
||||
Utilities.playerMsg(sender, "Unknown command. Type \"help\" for help.", ChatColor.RESET);
|
||||
return;
|
||||
}
|
||||
|
||||
TFM_Util.playerMsg(sender, TFM_Util.colorize(message));
|
||||
Utilities.playerMsg(sender, Utilities.colorize(message));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,11 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
public enum AdminLevel
|
||||
{
|
||||
public enum AdminLevel {
|
||||
ALL("All Player Commands"), OP("OP Commands"), SUPER("SuperAdmin Commands"), SENIOR("Senior Admin Commands");
|
||||
//
|
||||
private final String friendlyName;
|
||||
|
||||
private AdminLevel(String friendlyName)
|
||||
{
|
||||
private AdminLevel(String friendlyName) {
|
||||
this.friendlyName = friendlyName;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -8,22 +8,19 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_CommandHandler
|
||||
{
|
||||
public static final String COMMAND_PATH = TFM_Command.class.getPackage().getName(); // "me.StevenLawson.TotalFreedomMod.Commands";
|
||||
public class CommandHandler {
|
||||
public static final String COMMAND_PATH = FreedomCommand.class.getPackage().getName(); // "me.StevenLawson.TotalFreedomMod.Commands";
|
||||
public static final String COMMAND_PREFIX = "Command_";
|
||||
|
||||
public static boolean handleCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
public static boolean handleCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
final Player playerSender;
|
||||
final boolean senderIsConsole;
|
||||
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
if (sender instanceof Player) {
|
||||
senderIsConsole = false;
|
||||
playerSender = (Player) sender;
|
||||
|
||||
TFM_Log.info(String.format("[PLAYER_COMMAND] %s (%s): /%s %s",
|
||||
Log.info(String.format("[PLAYER_COMMAND] %s (%s): /%s %s",
|
||||
playerSender.getName(),
|
||||
ChatColor.stripColor(playerSender.getDisplayName()),
|
||||
commandLabel,
|
||||
|
@ -34,17 +31,17 @@ public class TFM_CommandHandler
|
|||
senderIsConsole = true;
|
||||
playerSender = null;
|
||||
|
||||
TFM_Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
||||
Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
||||
sender.getName(),
|
||||
commandLabel,
|
||||
StringUtils.join(args, " ")), true);
|
||||
}
|
||||
|
||||
final TFM_Command dispatcher;
|
||||
final FreedomCommand dispatcher;
|
||||
try
|
||||
{
|
||||
final ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
|
||||
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s",
|
||||
dispatcher = (FreedomCommand) classLoader.loadClass(String.format("%s.%s%s",
|
||||
COMMAND_PATH,
|
||||
COMMAND_PREFIX,
|
||||
cmd.getName().toLowerCase())).newInstance();
|
||||
|
@ -52,8 +49,8 @@ public class TFM_CommandHandler
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe("Could not load command: " + cmd.getName());
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe("Could not load command: " + cmd.getName());
|
||||
Log.severe(ex);
|
||||
|
||||
sender.sendMessage(ChatColor.RED + "Command Error! Could not load command: " + cmd.getName());
|
||||
return true;
|
||||
|
@ -61,7 +58,7 @@ public class TFM_CommandHandler
|
|||
|
||||
if (!dispatcher.senderHasPermission())
|
||||
{
|
||||
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
|
||||
sender.sendMessage(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -71,8 +68,8 @@ public class TFM_CommandHandler
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe("Command Error: " + commandLabel);
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe("Command Error: " + commandLabel);
|
||||
Log.severe(ex);
|
||||
sender.sendMessage(ChatColor.RED + "Command Error: " + ex.getMessage());
|
||||
}
|
||||
|
|
@ -1,40 +1,30 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.CodeSource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class TFM_CommandLoader
|
||||
{
|
||||
public class CommandLoader {
|
||||
public static final Pattern COMMAND_PATTERN;
|
||||
private static final List<TFM_CommandInfo> COMMAND_LIST;
|
||||
|
||||
static
|
||||
{
|
||||
COMMAND_PATTERN = Pattern.compile(TFM_CommandHandler.COMMAND_PATH.replace('.', '/') + "/(" + TFM_CommandHandler.COMMAND_PREFIX + "[^\\$]+)\\.class");
|
||||
static {
|
||||
COMMAND_PATTERN = Pattern.compile(CommandHandler.COMMAND_PATH.replace('.', '/') + "/(" + CommandHandler.COMMAND_PREFIX + "[^\\$]+)\\.class");
|
||||
COMMAND_LIST = new ArrayList<TFM_CommandInfo>();
|
||||
}
|
||||
|
||||
private TFM_CommandLoader()
|
||||
{
|
||||
private CommandLoader() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
|
@ -43,7 +33,7 @@ public class TFM_CommandLoader
|
|||
CommandMap commandMap = getCommandMap();
|
||||
if (commandMap == null)
|
||||
{
|
||||
TFM_Log.severe("Error loading commandMap.");
|
||||
Log.severe("Error loading commandMap.");
|
||||
return;
|
||||
}
|
||||
COMMAND_LIST.clear();
|
||||
|
@ -62,7 +52,7 @@ public class TFM_CommandLoader
|
|||
commandMap.register(TotalFreedomMod.plugin.getDescription().getName(), dynamicCommand);
|
||||
}
|
||||
|
||||
TFM_Log.info("TFM commands loaded.");
|
||||
Log.info("TFM commands loaded.");
|
||||
}
|
||||
|
||||
public static void unregisterCommand(String commandName)
|
||||
|
@ -95,14 +85,14 @@ public class TFM_CommandLoader
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static CommandMap getCommandMap()
|
||||
{
|
||||
final Object commandMap = TFM_Util.getField(Bukkit.getServer().getPluginManager(), "commandMap");
|
||||
final Object commandMap = Utilities.getField(Bukkit.getServer().getPluginManager(), "commandMap");
|
||||
if (commandMap != null)
|
||||
{
|
||||
if (commandMap instanceof CommandMap)
|
||||
|
@ -116,7 +106,7 @@ public class TFM_CommandLoader
|
|||
@SuppressWarnings("unchecked")
|
||||
public static HashMap<String, Command> getKnownCommands(CommandMap commandMap)
|
||||
{
|
||||
Object knownCommands = TFM_Util.getField(commandMap, "knownCommands");
|
||||
Object knownCommands = Utilities.getField(commandMap, "knownCommands");
|
||||
if (knownCommands != null)
|
||||
{
|
||||
if (knownCommands instanceof HashMap)
|
||||
|
@ -146,7 +136,7 @@ public class TFM_CommandLoader
|
|||
{
|
||||
try
|
||||
{
|
||||
Class<?> commandClass = Class.forName(TFM_CommandHandler.COMMAND_PATH + "." + matcher.group(1));
|
||||
Class<?> commandClass = Class.forName(CommandHandler.COMMAND_PATH + "." + matcher.group(1));
|
||||
|
||||
CommandPermissions commandPermissions = commandClass.getAnnotation(CommandPermissions.class);
|
||||
CommandParameters commandParameters = commandClass.getAnnotation(CommandParameters.class);
|
||||
|
@ -168,7 +158,7 @@ public class TFM_CommandLoader
|
|||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +166,7 @@ public class TFM_CommandLoader
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
|
||||
return commandList;
|
||||
|
@ -193,8 +183,7 @@ public class TFM_CommandLoader
|
|||
private final String usage;
|
||||
private final List<String> aliases;
|
||||
|
||||
public TFM_CommandInfo(Class<?> commandClass, String commandName, AdminLevel level, SourceType source, boolean blockHostConsole, String description, String usage, String aliases)
|
||||
{
|
||||
public TFM_CommandInfo(Class<?> commandClass, String commandName, AdminLevel level, SourceType source, boolean blockHostConsole, String description, String usage, String aliases) {
|
||||
this.commandName = commandName;
|
||||
this.commandClass = commandClass;
|
||||
this.level = level;
|
||||
|
@ -245,8 +234,7 @@ public class TFM_CommandLoader
|
|||
return _description;
|
||||
}
|
||||
|
||||
public AdminLevel getLevel()
|
||||
{
|
||||
public AdminLevel getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
|
@ -1,4 +1,4 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
|
@ -0,0 +1,40 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
|
||||
public class Command_adminmode extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off")) {
|
||||
ConfigurationEntry.ADMIN_ONLY_MODE.setBoolean(false);
|
||||
Utilities.adminAction(sender.getName(), "Opening the server to all players.", true);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
ConfigurationEntry.ADMIN_ONLY_MODE.setBoolean(true);
|
||||
Utilities.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!AdminList.isSuperAdmin(player))
|
||||
{
|
||||
player.kickPlayer("Server is now closed to non-superadmins.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import me.StevenLawson.TotalFreedomMod.world.AdminWorld;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -10,24 +10,18 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.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>]")
|
||||
public class Command_adminworld extends TFM_Command
|
||||
{
|
||||
private enum CommandMode
|
||||
{
|
||||
public class Command_adminworld extends FreedomCommand {
|
||||
private enum CommandMode {
|
||||
TELEPORT, GUEST, TIME, WEATHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
CommandMode commandMode = null;
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (args.length == 0) {
|
||||
commandMode = CommandMode.TELEPORT;
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
} else if (args.length >= 2) {
|
||||
if ("guest".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
commandMode = CommandMode.GUEST;
|
||||
|
@ -61,7 +55,7 @@ public class Command_adminworld extends TFM_Command
|
|||
World adminWorld = null;
|
||||
try
|
||||
{
|
||||
adminWorld = TFM_AdminWorld.getInstance().getWorld();
|
||||
adminWorld = AdminWorld.getInstance().getWorld();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -74,10 +68,10 @@ public class Command_adminworld extends TFM_Command
|
|||
}
|
||||
else
|
||||
{
|
||||
if (TFM_AdminWorld.getInstance().canAccessWorld(sender_p))
|
||||
if (AdminWorld.getInstance().canAccessWorld(sender_p))
|
||||
{
|
||||
playerMsg("Going to the AdminWorld.");
|
||||
TFM_AdminWorld.getInstance().sendToWorld(sender_p);
|
||||
AdminWorld.getInstance().sendToWorld(sender_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -93,13 +87,13 @@ public class Command_adminworld extends TFM_Command
|
|||
{
|
||||
if ("list".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
playerMsg("AdminWorld guest list: " + TFM_AdminWorld.getInstance().guestListToString());
|
||||
playerMsg("AdminWorld guest list: " + AdminWorld.getInstance().guestListToString());
|
||||
}
|
||||
else if ("purge".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
assertCommandPerms(sender, sender_p);
|
||||
TFM_AdminWorld.getInstance().purgeGuestList();
|
||||
TFM_Util.adminAction(sender.getName(), "AdminWorld guest list purged.", false);
|
||||
AdminWorld.getInstance().purgeGuestList();
|
||||
Utilities.adminAction(sender.getName(), "AdminWorld guest list purged.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -116,13 +110,13 @@ public class Command_adminworld extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_AdminWorld.getInstance().addGuest(player, sender_p))
|
||||
if (AdminWorld.getInstance().addGuest(player, sender_p))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
|
||||
Utilities.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -131,10 +125,10 @@ public class Command_adminworld extends TFM_Command
|
|||
}
|
||||
else if ("remove".equals(args[1]))
|
||||
{
|
||||
final Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]);
|
||||
final Player player = AdminWorld.getInstance().removeGuest(args[2]);
|
||||
if (player != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
|
||||
Utilities.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -155,10 +149,10 @@ public class Command_adminworld extends TFM_Command
|
|||
|
||||
if (args.length == 2)
|
||||
{
|
||||
TFM_AdminWorld.TimeOfDay timeOfDay = TFM_AdminWorld.TimeOfDay.getByAlias(args[1]);
|
||||
AdminWorld.TimeOfDay timeOfDay = AdminWorld.TimeOfDay.getByAlias(args[1]);
|
||||
if (timeOfDay != null)
|
||||
{
|
||||
TFM_AdminWorld.getInstance().setTimeOfDay(timeOfDay);
|
||||
AdminWorld.getInstance().setTimeOfDay(timeOfDay);
|
||||
playerMsg("AdminWorld time set to: " + timeOfDay.name());
|
||||
}
|
||||
else
|
||||
|
@ -179,10 +173,10 @@ public class Command_adminworld extends TFM_Command
|
|||
|
||||
if (args.length == 2)
|
||||
{
|
||||
TFM_AdminWorld.WeatherMode weatherMode = TFM_AdminWorld.WeatherMode.getByAlias(args[1]);
|
||||
AdminWorld.WeatherMode weatherMode = AdminWorld.WeatherMode.getByAlias(args[1]);
|
||||
if (weatherMode != null)
|
||||
{
|
||||
TFM_AdminWorld.getInstance().setWeatherMode(weatherMode);
|
||||
AdminWorld.getInstance().setWeatherMode(weatherMode);
|
||||
playerMsg("AdminWorld weather set to: " + weatherMode.name());
|
||||
}
|
||||
else
|
||||
|
@ -211,11 +205,9 @@ public class Command_adminworld extends TFM_Command
|
|||
return true;
|
||||
}
|
||||
|
||||
private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException
|
||||
{
|
||||
if (!(sender instanceof Player) || sender_p == null || !TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
throw new PermissionDeniedException(TFM_Command.MSG_NO_PERMS);
|
||||
private void assertCommandPerms(CommandSender sender, org.bukkit.entity.Player sender_p) throws PermissionDeniedException {
|
||||
if (!(sender instanceof Player) || sender_p == null || !AdminList.isSuperAdmin(sender)) {
|
||||
throw new PermissionDeniedException(FreedomCommand.MSG_NO_PERMS);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,27 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
|
||||
public class Command_blockcmd extends TFM_Command
|
||||
{
|
||||
public class Command_blockcmd 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unblocking commands for all players", true);
|
||||
if (args[0].equalsIgnoreCase("purge")) {
|
||||
Utilities.adminAction(sender.getName(), "Unblocking commands for all players", true);
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
if (playerdata.allCommandsBlocked())
|
||||
{
|
||||
counter += 1;
|
||||
|
@ -40,21 +36,21 @@ public class Command_blockcmd extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
if (AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
|
||||
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
|
||||
playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
|
||||
|
||||
return true;
|
|
@ -1,7 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -11,20 +11,16 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [outermaterial] [innermaterial]>")
|
||||
public class Command_cage extends TFM_Command
|
||||
{
|
||||
public class Command_cage extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ("off".equals(args[0]) && sender instanceof Player)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
|
||||
if ("off".equals(args[0]) && sender instanceof Player) {
|
||||
Utilities.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(sender_p);
|
||||
|
||||
playerdata.setCaged(false);
|
||||
playerdata.regenerateHistory();
|
||||
|
@ -34,11 +30,11 @@ public class Command_cage extends TFM_Command
|
|||
}
|
||||
else if ("purge".equals(args[0]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging all players", true);
|
||||
Utilities.adminAction(sender.getName(), "Uncaging all players", true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
playerdata.setCaged(false);
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
|
@ -51,11 +47,11 @@ public class Command_cage extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
|
||||
Material outerMaterial = Material.GLASS;
|
||||
Material innerMaterial = Material.AIR;
|
||||
|
@ -64,7 +60,7 @@ public class Command_cage extends TFM_Command
|
|||
{
|
||||
if ("off".equals(args[1]))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Uncaging " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), "Uncaging " + player.getName(), true);
|
||||
|
||||
playerdata.setCaged(false);
|
||||
playerdata.regenerateHistory();
|
||||
|
@ -101,19 +97,19 @@ public class Command_cage extends TFM_Command
|
|||
playerdata.setCaged(true, targetPos, outerMaterial, innerMaterial);
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
TFM_Util.buildHistory(targetPos, 2, playerdata);
|
||||
TFM_Util.generateHollowCube(targetPos, 2, outerMaterial);
|
||||
TFM_Util.generateCube(targetPos, 1, innerMaterial);
|
||||
Utilities.buildHistory(targetPos, 2, playerdata);
|
||||
Utilities.generateHollowCube(targetPos, 2, outerMaterial);
|
||||
Utilities.generateCube(targetPos, 1, innerMaterial);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
if (outerMaterial != Material.SKULL)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Caging " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), "Caging " + player.getName(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Caging " + player.getName() + " in PURE_DARTH", true);
|
||||
Utilities.adminAction(sender.getName(), "Caging " + player.getName() + " in PURE_DARTH", true);
|
||||
}
|
||||
|
||||
return true;
|
|
@ -1,7 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
@ -11,21 +10,20 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
|
||||
public class Command_cake extends TFM_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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
final StringBuilder output = new StringBuilder();
|
||||
|
||||
final String[] words = CAKE_LYRICS.split(" ");
|
||||
for (final String word : words)
|
||||
{
|
||||
for (final String word : words) {
|
||||
output.append(ChatColor.COLOR_CHAR).append(Integer.toHexString(1 + random.nextInt(14))).append(word).append(" ");
|
||||
}
|
||||
|
||||
|
@ -45,7 +43,7 @@ public class Command_cake extends TFM_Command
|
|||
player.awardAchievement(Achievement.BAKE_CAKE);
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(output.toString());
|
||||
Utilities.bcastMsg(output.toString());
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Minecart;
|
||||
|
@ -8,21 +8,17 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sit in nearest minecart. If target is in a minecart already, they will disembark.", usage = "/<command> [partialname]")
|
||||
public class Command_cartsit extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Player targetPlayer = sender_p;
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args.length == 1) {
|
||||
|
||||
targetPlayer = getPlayer(args[0]);
|
||||
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
if (targetPlayer == null) {
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +31,7 @@ public class Command_cartsit extends TFM_Command
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (targetPlayer != sender_p && !TFM_AdminList.isSuperAdmin(sender))
|
||||
else if (targetPlayer != sender_p && !AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
|
||||
return true;
|
|
@ -1,11 +1,8 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.util.DeprecationUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -16,21 +13,21 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "No Description Yet", usage = "/<command>")
|
||||
public class Command_cbtool extends TFM_Command
|
||||
{
|
||||
public class Command_cbtool 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player)
|
||||
{
|
||||
Block targetBlock = TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100);
|
||||
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player) {
|
||||
Block targetBlock = DeprecationUtil.getTargetBlock(sender_p, null, 100);
|
||||
playerMsg("Your target block: " + targetBlock.getLocation().toString());
|
||||
return true;
|
||||
}
|
||||
|
@ -46,7 +43,7 @@ public class Command_cbtool extends TFM_Command
|
|||
}
|
||||
matcher.appendTail(generatedCommand);
|
||||
|
||||
if (TFM_CommandBlocker.isCommandBlocked(generatedCommand.toString(), sender, false))
|
||||
if (CommandBlocker.isCommandBlocked(generatedCommand.toString(), sender, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -58,7 +55,7 @@ public class Command_cbtool extends TFM_Command
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
|
||||
return true;
|
|
@ -1,30 +1,26 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>")
|
||||
public class Command_cmdlist extends TFM_Command
|
||||
{
|
||||
public class Command_cmdlist extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
List<String> commands = new ArrayList<String>();
|
||||
|
||||
for (Plugin targetPlugin : server.getPluginManager().getPlugins())
|
||||
{
|
||||
try
|
||||
{
|
||||
for (Plugin targetPlugin : server.getPluginManager().getPlugins()) {
|
||||
try {
|
||||
PluginDescriptionFile desc = targetPlugin.getDescription();
|
||||
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Spy on commands", usage = "/<command>", aliases = "commandspy")
|
||||
public class Command_cmdspy extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(sender_p);
|
||||
playerdata.setCommandSpy(!playerdata.cmdspyEnabled());
|
||||
playerMsg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled."));
|
||||
|
|
@ -1,36 +1,32 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Color your current nickname.", usage = "/<command> <color>")
|
||||
public class Command_colorme extends TFM_Command
|
||||
{
|
||||
public class Command_colorme 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ("list".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
playerMsg("Colors: " + StringUtils.join(TFM_Util.CHAT_COLOR_NAMES.keySet(), ", "));
|
||||
if ("list".equalsIgnoreCase(args[0])) {
|
||||
playerMsg("Colors: " + StringUtils.join(Utilities.CHAT_COLOR_NAMES.keySet(), ", "));
|
||||
return true;
|
||||
}
|
||||
|
||||
final String needle = args[0].trim().toLowerCase();
|
||||
ChatColor color = null;
|
||||
final Iterator<Map.Entry<String, ChatColor>> it = TFM_Util.CHAT_COLOR_NAMES.entrySet().iterator();
|
||||
final Iterator<Map.Entry<String, ChatColor>> it = Utilities.CHAT_COLOR_NAMES.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Map.Entry<String, ChatColor> entry = it.next();
|
||||
|
@ -49,7 +45,7 @@ public class Command_colorme extends TFM_Command
|
|||
|
||||
final String newNick = color + ChatColor.stripColor(sender_p.getDisplayName()).trim() + ChatColor.WHITE;
|
||||
|
||||
TFM_EssentialsBridge.setNickname(sender.getName(), newNick);
|
||||
EssentialsBridge.setNickname(sender.getName(), newNick);
|
||||
|
||||
playerMsg("Your nickname is now: " + newNick);
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -9,15 +9,11 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@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 TFM_Command
|
||||
{
|
||||
public class Command_creative extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("When used from the console, you must define a target user to change gamemode on.");
|
||||
return true;
|
||||
}
|
||||
|
@ -32,9 +28,9 @@ public class Command_creative extends TFM_Command
|
|||
{
|
||||
if (args[0].equalsIgnoreCase("-a"))
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
|
||||
sender.sendMessage(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -43,11 +39,11 @@ public class Command_creative extends TFM_Command
|
|||
targetPlayer.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);
|
||||
Utilities.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
|
||||
if (!(senderIsConsole || AdminList.isSuperAdmin(sender)))
|
||||
{
|
||||
playerMsg("Only superadmins can change other user's gamemode.");
|
||||
return true;
|
||||
|
@ -57,7 +53,7 @@ public class Command_creative extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_CONSOLE)
|
||||
@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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length > 0) {
|
||||
Utilities.bcastMsg(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender.getName(), StringUtils.join(args, " ")));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.Random;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -8,24 +7,21 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Make some noise.", usage = "/<command>")
|
||||
public class Command_deafen extends TFM_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)
|
||||
{
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
for (double percent = 0.0; percent <= 1.0; percent += (1.0 / STEPS))
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
for (final Player player : server.getOnlinePlayers()) {
|
||||
for (double percent = 0.0; percent <= 1.0; percent += (1.0 / STEPS)) {
|
||||
final float pitch = (float) (percent * 2.0);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
|
@ -1,26 +1,22 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "For developers only - debug things via reflection.", usage = "/<command>")
|
||||
public class Command_debug extends TFM_Command
|
||||
{
|
||||
public class Command_debug extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
String className = args[0];
|
||||
String fieldName = args[1];
|
||||
String newValue = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
|
|
@ -0,0 +1,22 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Removing all nicknames", false);
|
||||
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
EssentialsBridge.setNickname(player.getName(), null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,44 +1,40 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
|
||||
public class Command_deop extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OfflinePlayer player = null;
|
||||
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
player = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
||||
|
||||
player.setOp(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.DeprecationUtil;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
|
||||
public class Command_deop extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OfflinePlayer player = null;
|
||||
|
||||
for (Player onlinePlayer : server.getOnlinePlayers()) {
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
player = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
player = DeprecationUtil.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
|
||||
Utilities.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
||||
|
||||
player.setOp(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
|
||||
public class Command_deopall extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "De-opping all players on the server", true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
player.setOp(false);
|
||||
player.sendMessage(FreedomCommand.YOU_ARE_NOT_OP);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.util.DeprecationUtil;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -11,26 +9,23 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Fill nearby dispensers with a set of items of your choice.", usage = "/<command> <radius> <comma,separated,items>")
|
||||
public class Command_dispfill extends TFM_Command
|
||||
{
|
||||
public class Command_dispfill extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 2) {
|
||||
int radius;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
radius = Math.max(5, Math.min(25, Integer.parseInt(args[0])));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
} catch (NumberFormatException ex)
|
||||
{
|
||||
sender.sendMessage("Invalid radius.");
|
||||
return true;
|
||||
|
@ -46,7 +41,7 @@ public class Command_dispfill extends TFM_Command
|
|||
{
|
||||
try
|
||||
{
|
||||
material = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
|
||||
material = DeprecationUtil.getMaterial(Integer.parseInt(searchItem));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
@ -79,7 +74,7 @@ public class Command_dispfill extends TFM_Command
|
|||
{
|
||||
if (targetBlock.getType().equals(Material.DISPENSER))
|
||||
{
|
||||
sender.sendMessage("Filling dispenser @ " + TFM_Util.formatLocation(targetBlock.getLocation()));
|
||||
sender.sendMessage("Filling dispenser @ " + Utilities.formatLocation(targetBlock.getLocation()));
|
||||
setDispenserContents(targetBlock, itemsArray);
|
||||
affected++;
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -14,35 +14,31 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "For the bad Superadmins", usage = "/<command> <playername>")
|
||||
public class Command_doom extends TFM_Command
|
||||
{
|
||||
@CommandParameters(description = "For the bad Super Admins", 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)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
public boolean run(final CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
if (player == null) {
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
|
||||
TFM_Util.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED);
|
||||
Utilities.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
|
||||
Utilities.bcastMsg(player.getName() + " will be completely obliterated!", ChatColor.RED);
|
||||
|
||||
final String ip = player.getAddress().getAddress().getHostAddress().trim();
|
||||
|
||||
// remove from superadmin
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
if (AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
|
||||
TFM_AdminList.removeSuperadmin(player);
|
||||
Utilities.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
|
||||
AdminList.removeSuperadmin(player);
|
||||
}
|
||||
|
||||
// remove from whitelist
|
||||
|
@ -52,13 +48,13 @@ public class Command_doom extends TFM_Command
|
|||
player.setOp(false);
|
||||
|
||||
// ban IPs
|
||||
for (String playerIp : TFM_PlayerList.getEntry(player).getIps())
|
||||
for (String playerIp : PlayerList.getEntry(player).getIps())
|
||||
{
|
||||
TFM_BanManager.addIpBan(new TFM_Ban(playerIp, player.getName()));
|
||||
BanManager.addIpBan(new Ban(playerIp, player.getName()));
|
||||
}
|
||||
|
||||
// ban uuid
|
||||
TFM_BanManager.addUuidBan(player);
|
||||
BanManager.addUuidBan(player);
|
||||
|
||||
// set gamemode to survival
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
|
@ -70,8 +66,7 @@ public class Command_doom extends TFM_Command
|
|||
// ignite player
|
||||
player.setFireTicks(10000);
|
||||
|
||||
// generate explosion
|
||||
player.getWorld().createExplosion(player.getLocation(), 4F);
|
||||
//removed explosion (it bypasses TFM's explosive toggle and makes a BIG hole that no one likes fixing)
|
||||
|
||||
// Shoot the player in the sky
|
||||
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0)));
|
||||
|
@ -95,10 +90,9 @@ public class Command_doom extends TFM_Command
|
|||
public void run()
|
||||
{
|
||||
// message
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + ip, true);
|
||||
Utilities.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + Utilities.getFuzzyIp(ip), true);
|
||||
|
||||
// generate explosion
|
||||
player.getWorld().createExplosion(player.getLocation(), 4F);
|
||||
//removed explosion (it bypasses TFM's explosive toggle and makes a BIG hole that no one likes fixing)
|
||||
|
||||
// kick player
|
||||
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
|
|
@ -1,28 +1,23 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Enchant items.", usage = "/<command> <list | addall | reset | add <name> | remove <name>>")
|
||||
public class Command_enchant extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemInHand = sender_p.getItemInHand();
|
||||
|
||||
if (itemInHand == null)
|
||||
{
|
||||
if (itemInHand == null) {
|
||||
playerMsg("You are holding an invalid item.");
|
||||
return true;
|
||||
}
|
||||
|
@ -63,7 +58,7 @@ public class Command_enchant extends TFM_Command
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.info("Error using " + ench.getName() + " on " + itemInHand.getType().name() + " held by " + sender_p.getName() + ".");
|
||||
Log.info("Error using " + ench.getName() + " on " + itemInHand.getType().name() + " held by " + sender_p.getName() + ".");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
|
||||
public class Command_ender extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_the_end");
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -10,20 +8,19 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
|
||||
public class Command_expel extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
double radius = 20.0;
|
||||
double strength = 5.0;
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args.length >= 1) {
|
||||
try {
|
||||
radius = Math.max(1.0, Math.min(100.0, Double.parseDouble(args[0])));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
|
@ -68,7 +65,7 @@ public class Command_expel extends TFM_Command
|
|||
if (inRange)
|
||||
{
|
||||
player.getWorld().createExplosion(targetPos, 0.0f, false);
|
||||
TFM_Util.setFlying(player, false);
|
||||
Utilities.setFlying(player, false);
|
||||
player.setVelocity(targetPosVec.subtract(senderPos).normalize().multiply(strength));
|
||||
pushedPlayers.add(player.getName());
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows all IPs registered to a player", usage = "/<command> <player>")
|
||||
public class Command_findip extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg("Player IPs: " + StringUtils.join(PlayerList.getEntry(player).getIps(), ", "));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.world.FlatlandsWorld;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Goto the flatlands.", usage = "/<command>")
|
||||
public class Command_flatlands extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (ConfigurationEntry.FLATLANDS_GENERATE.getBoolean()) {
|
||||
FlatlandsWorld.getInstance().sendToWorld(sender_p);
|
||||
} else {
|
||||
playerMsg("Flatlands is currently disabled.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -11,27 +11,23 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]")
|
||||
public class Command_fr extends TFM_Command
|
||||
{
|
||||
public class Command_fr extends FreedomCommand {
|
||||
private static boolean allFrozen = false;
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
allFrozen = !allFrozen;
|
||||
|
||||
if (allFrozen)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
|
||||
if (allFrozen) {
|
||||
Utilities.adminAction(sender.getName(), "Freezing all players", false);
|
||||
|
||||
setAllFrozen(true);
|
||||
playerMsg("Players are now frozen.");
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
if (!AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
|
||||
}
|
||||
|
@ -39,7 +35,7 @@ public class Command_fr extends TFM_Command
|
|||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
Utilities.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
setAllFrozen(false);
|
||||
playerMsg("Players are now free to move.");
|
||||
}
|
||||
|
@ -49,7 +45,7 @@ public class Command_fr extends TFM_Command
|
|||
if (args[0].toLowerCase().equals("purge"))
|
||||
{
|
||||
setAllFrozen(false);
|
||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
Utilities.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,11 +53,11 @@ public class Command_fr extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
final PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
|
||||
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
|
@ -75,7 +71,7 @@ public class Command_fr extends TFM_Command
|
|||
public static void setAllFrozen(boolean freeze)
|
||||
{
|
||||
allFrozen = freeze;
|
||||
for (TFM_PlayerData data : TFM_PlayerData.PLAYER_DATA.values())
|
||||
for (PlayerData data : PlayerData.PLAYER_DATA.values())
|
||||
{
|
||||
data.setFrozen(freeze);
|
||||
}
|
|
@ -1,19 +1,15 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command>")
|
||||
public class Command_fuckoff extends TFM_Command
|
||||
{
|
||||
public class Command_fuckoff 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1,23 +1,22 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.Iterator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci, fr, smite.",
|
||||
usage = "/<command> [list | [<kick | nameban | ipban | ban | op | deop | ci | fr | smite> <targethash>] ]")
|
||||
public class Command_gadmin extends TFM_Command
|
||||
{
|
||||
private enum GadminMode
|
||||
{
|
||||
public class Command_gadmin extends FreedomCommand {
|
||||
private enum GadminMode {
|
||||
LIST("list"),
|
||||
KICK("kick"),
|
||||
NAMEBAN("nameban"),
|
||||
|
@ -54,16 +53,13 @@ public class Command_gadmin extends TFM_Command
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final GadminMode mode = GadminMode.findMode(args[0].toLowerCase());
|
||||
if (mode == null)
|
||||
{
|
||||
if (mode == null) {
|
||||
playerMsg("Invalid mode: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
@ -76,7 +72,7 @@ public class Command_gadmin extends TFM_Command
|
|||
while (it.hasNext())
|
||||
{
|
||||
final Player player = it.next();
|
||||
final String hash = TFM_UuidManager.getUniqueId(player).toString().substring(0, 4);
|
||||
final String hash = UUIDManager.getUniqueId(player).toString().substring(0, 4);
|
||||
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
|
||||
player.getName(),
|
||||
ChatColor.stripColor(player.getDisplayName()),
|
||||
|
@ -94,7 +90,7 @@ public class Command_gadmin extends TFM_Command
|
|||
while (it.hasNext() && target == null)
|
||||
{
|
||||
final Player player = it.next();
|
||||
final String hash = TFM_UuidManager.getUniqueId(player).toString().substring(0, 4);
|
||||
final String hash = UUIDManager.getUniqueId(player).toString().substring(0, 4);
|
||||
|
||||
if (hash.equalsIgnoreCase(args[1]))
|
||||
{
|
||||
|
@ -112,16 +108,16 @@ public class Command_gadmin extends TFM_Command
|
|||
{
|
||||
case KICK:
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Kicking: %s.", target.getName()), false);
|
||||
Utilities.adminAction(sender.getName(), String.format("Kicking: %s.", target.getName()), false);
|
||||
target.kickPlayer("Kicked by Administrator");
|
||||
|
||||
break;
|
||||
}
|
||||
case NAMEBAN:
|
||||
{
|
||||
TFM_BanManager.addUuidBan(target);
|
||||
BanManager.addUuidBan(target);
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s.", target.getName()), true);
|
||||
Utilities.adminAction(sender.getName(), String.format("Banning Name: %s.", target.getName()), true);
|
||||
target.kickPlayer("Username banned by Administrator.");
|
||||
|
||||
break;
|
||||
|
@ -134,8 +130,8 @@ public class Command_gadmin extends TFM_Command
|
|||
{
|
||||
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning IP: %s.", ip), true);
|
||||
TFM_BanManager.addIpBan(target);
|
||||
Utilities.adminAction(sender.getName(), String.format("Banning IP: %s.", ip), true);
|
||||
BanManager.addIpBan(target);
|
||||
|
||||
target.kickPlayer("IP address banned by Administrator.");
|
||||
|
||||
|
@ -149,10 +145,10 @@ public class Command_gadmin extends TFM_Command
|
|||
{
|
||||
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", target.getName(), ip), true);
|
||||
Utilities.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", target.getName(), ip), true);
|
||||
|
||||
TFM_BanManager.addUuidBan(target);
|
||||
TFM_BanManager.addIpBan(target);
|
||||
BanManager.addUuidBan(target);
|
||||
BanManager.addIpBan(target);
|
||||
|
||||
target.kickPlayer("IP and username banned by Administrator.");
|
||||
|
||||
|
@ -160,17 +156,17 @@ public class Command_gadmin extends TFM_Command
|
|||
}
|
||||
case OP:
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Opping %s.", target.getName()), false);
|
||||
Utilities.adminAction(sender.getName(), String.format("Opping %s.", target.getName()), false);
|
||||
target.setOp(false);
|
||||
target.sendMessage(TFM_Command.YOU_ARE_OP);
|
||||
target.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
|
||||
break;
|
||||
}
|
||||
case DEOP:
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), String.format("Deopping %s.", target.getName()), false);
|
||||
Utilities.adminAction(sender.getName(), String.format("Deopping %s.", target.getName()), false);
|
||||
target.setOp(false);
|
||||
target.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
|
||||
target.sendMessage(FreedomCommand.YOU_ARE_NOT_OP);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -182,7 +178,7 @@ public class Command_gadmin extends TFM_Command
|
|||
}
|
||||
case FR:
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(target);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(target);
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
|
||||
playerMsg(target.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
|
@ -1,6 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -8,27 +8,23 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
|
||||
public class Command_gcmd extends TFM_Command
|
||||
{
|
||||
public class Command_gcmd extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
if (player == null) {
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outCommand = StringUtils.join(args, " ", 1, args.length);
|
||||
|
||||
if (TFM_CommandBlocker.isCommandBlocked(outCommand, sender))
|
||||
if (CommandBlocker.isCommandBlocked(outCommand, sender))
|
||||
{
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.player.Player;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Ban/Unban 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("purge")) {
|
||||
if (AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
PlayerList.purgeAll();
|
||||
playerMsg("Purged playerbase");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Only Senior Admins may purge the userlist.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (args.length == 2)
|
||||
{
|
||||
String username;
|
||||
final List<String> ips = new ArrayList<String>();
|
||||
|
||||
final org.bukkit.entity.Player player = getPlayer(args[1]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
final me.StevenLawson.TotalFreedomMod.player.Player entry = PlayerList.getEntry(UUIDManager.getUniqueId(args[1]));
|
||||
|
||||
if (entry == null) {
|
||||
playerMsg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||
return true;
|
||||
}
|
||||
|
||||
username = entry.getLastLoginName();
|
||||
for (String ip : entry.getIps()) {
|
||||
ips.add(Utilities.getFuzzyIp(ip));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
username = player.getName();
|
||||
final Player entry = PlayerList.getEntry(UUIDManager.getUniqueId(player));
|
||||
|
||||
for (String ip : entry.getIps()) {
|
||||
ips.add(Utilities.getFuzzyIp(ip));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String mode = args[0].toLowerCase();
|
||||
if (mode.equalsIgnoreCase("ban"))
|
||||
{
|
||||
Utilities.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
|
||||
|
||||
final org.bukkit.entity.Player target = getPlayer(username, true);
|
||||
if (target != null)
|
||||
{
|
||||
BanManager.addUuidBan(new Ban(UUIDManager.getUniqueId(target), target.getName()));
|
||||
target.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: " + ConfigurationEntry.SERVER_BAN_URL.getString());
|
||||
}
|
||||
else
|
||||
{
|
||||
BanManager.addUuidBan(new Ban(UUIDManager.getUniqueId(username), username));
|
||||
}
|
||||
|
||||
for (String ip : ips)
|
||||
{
|
||||
BanManager.addIpBan(new Ban(ip, username));
|
||||
BanManager.addIpBan(new Ban(Utilities.getFuzzyIp(ip), username));
|
||||
}
|
||||
}
|
||||
else if (mode.equalsIgnoreCase("unban"))
|
||||
{
|
||||
Utilities.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
|
||||
BanManager.unbanUuid(UUIDManager.getUniqueId(username));
|
||||
for (String ip : ips)
|
||||
{
|
||||
|
||||
BanManager.unbanIp(ip);
|
||||
BanManager.unbanIp(Utilities.getFuzzyIp(ip));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.player.UUIDManager;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import me.StevenLawson.TotalFreedomMod.world.RollbackManager;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -17,21 +17,17 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes someone GTFO (deop and ip ban by username).", usage = "/<command> <partialname>")
|
||||
public class Command_gtfo extends TFM_Command
|
||||
{
|
||||
public class Command_gtfo extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,19 +37,19 @@ public class Command_gtfo extends TFM_Command
|
|||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
Utilities.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
// Undo WorldEdits:
|
||||
try
|
||||
{
|
||||
TFM_WorldEditBridge.undo(player, 15);
|
||||
WorldEditBridge.undo(player, 15);
|
||||
}
|
||||
catch (NoClassDefFoundError ex)
|
||||
{
|
||||
}
|
||||
|
||||
// rollback
|
||||
TFM_RollbackManager.rollback(player.getName());
|
||||
RollbackManager.rollback(player.getName());
|
||||
|
||||
// deop
|
||||
player.setOp(false);
|
||||
|
@ -76,7 +72,7 @@ public class Command_gtfo extends TFM_Command
|
|||
}
|
||||
|
||||
// ban IP address:
|
||||
String ip = TFM_Util.getFuzzyIp(player.getAddress().getAddress().getHostAddress());
|
||||
String ip = Utilities.getFuzzyIp(player.getAddress().getAddress().getHostAddress());
|
||||
|
||||
final StringBuilder bcast = new StringBuilder()
|
||||
.append(ChatColor.RED)
|
||||
|
@ -90,12 +86,12 @@ public class Command_gtfo extends TFM_Command
|
|||
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason);
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(bcast.toString());
|
||||
Utilities.bcastMsg(bcast.toString());
|
||||
|
||||
TFM_BanManager.addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
|
||||
BanManager.addIpBan(new Ban(ip, player.getName(), sender.getName(), null, reason));
|
||||
|
||||
// ban username:
|
||||
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_UuidManager.getUniqueId(player), player.getName(), sender.getName(), null, reason));
|
||||
BanManager.addUuidBan(new Ban(UUIDManager.getUniqueId(player), player.getName(), sender.getName(), null, reason));
|
||||
|
||||
// kick Player:
|
||||
player.kickPlayer(ChatColor.RED + "GTFO" + (reason != null ? ("\nReason: " + ChatColor.YELLOW + reason) : ""));
|
|
@ -1,33 +1,29 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Halts a player", usage = "/<command> <<partialname> | all | purge | list>")
|
||||
public class Command_halt extends TFM_Command
|
||||
{
|
||||
public class Command_halt 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Halting all non-superadmins.", true);
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
Utilities.adminAction(sender.getName(), "Halting all non-superadmins.", true);
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
if (!AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_PlayerData.getPlayerData(player).setHalted(true);
|
||||
PlayerData.getPlayerData(player).setHalted(true);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
@ -37,12 +33,12 @@ public class Command_halt extends TFM_Command
|
|||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unhalting all players.", true);
|
||||
Utilities.adminAction(sender.getName(), "Unhalting all players.", true);
|
||||
int counter = 0;
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
if (TFM_PlayerData.getPlayerData(player).isHalted())
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
if (PlayerData.getPlayerData(player).isHalted())
|
||||
{
|
||||
playerdata.setHalted(false);
|
||||
counter++;
|
||||
|
@ -54,11 +50,11 @@ public class Command_halt extends TFM_Command
|
|||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
TFM_PlayerData info;
|
||||
PlayerData info;
|
||||
int count = 0;
|
||||
for (Player hp : server.getOnlinePlayers())
|
||||
{
|
||||
info = TFM_PlayerData.getPlayerData(hp);
|
||||
info = PlayerData.getPlayerData(hp);
|
||||
if (info.isHalted())
|
||||
{
|
||||
if (count == 0)
|
||||
|
@ -80,20 +76,20 @@ public class Command_halt extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
if (!playerdata.isHalted())
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Halting " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), "Halting " + player.getName(), true);
|
||||
playerdata.setHalted(true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unhalting " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), "Unhalting " + player.getName(), true);
|
||||
playerdata.setHalted(false);
|
||||
return true;
|
||||
}
|
|
@ -1,27 +1,25 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang.math.DoubleRange;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "View ticks-per-second", usage = "/<command>")
|
||||
public class Command_health extends TFM_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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
long usedMem = runtime.totalMemory() - runtime.freeMemory();
|
||||
|
||||
|
@ -53,7 +51,7 @@ public class Command_health extends TFM_Command
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(plugin);
|
|
@ -1,31 +1,27 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
|
||||
public class Command_invis extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
boolean smite = false;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("smite"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true);
|
||||
if (args.length >= 1) {
|
||||
if (args[0].equalsIgnoreCase("smite")) {
|
||||
Utilities.adminAction(sender.getName(), "Smiting all invisible players", true);
|
||||
smite = true;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -39,7 +35,7 @@ public class Command_invis extends TFM_Command
|
|||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (smite && !TFM_AdminList.isSuperAdmin(player))
|
||||
if (smite && !AdminList.isSuperAdmin(player))
|
||||
{
|
||||
player.setHealth(0.0);
|
||||
smites++;
|
|
@ -0,0 +1,88 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.fun.JumpPads;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0 || args.length > 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("info")) {
|
||||
playerMsg("Jumppads: " + (JumpPads.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
playerMsg("Sideways: " + (JumpPads.getMode() == JumpPads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
playerMsg("Strength: " + (JumpPads.getStrength() * 10 - 1), ChatColor.BLUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("off".equals(args[0]))
|
||||
{
|
||||
Utilities.adminAction(sender.getName(), "Disabling Jumppads", false);
|
||||
JumpPads.setMode(JumpPads.JumpPadMode.OFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utilities.adminAction(sender.getName(), "Enabling Jumppads", false);
|
||||
JumpPads.setMode(JumpPads.JumpPadMode.MADGEEK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (JumpPads.getMode() == JumpPads.JumpPadMode.OFF)
|
||||
{
|
||||
playerMsg("Jumppads are currently disabled, please enable them before changing jumppads settings.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("sideways"))
|
||||
{
|
||||
if ("off".equals(args[1]))
|
||||
{
|
||||
Utilities.adminAction(sender.getName(), "Setting Jumppads mode to: Madgeek", false);
|
||||
JumpPads.setMode(JumpPads.JumpPadMode.MADGEEK);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utilities.adminAction(sender.getName(), "Setting Jumppads mode to: Normal and Sideways", false);
|
||||
JumpPads.setMode(JumpPads.JumpPadMode.NORMAL_AND_SIDEWAYS);
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("strength"))
|
||||
{
|
||||
final float strength;
|
||||
try
|
||||
{
|
||||
strength = Float.parseFloat(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
playerMsg("Invalid Strength");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strength > 10 || strength < 1)
|
||||
{
|
||||
playerMsg("Invalid Strength: The strength may be 1 through 10.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Utilities.adminAction(sender.getName(), "Setting Jumppads strength to: " + String.valueOf(strength), false);
|
||||
JumpPads.setStrength((strength / 10) + 0.1F);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
|
||||
public class Command_kicknoob extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
if (!AdminList.isSuperAdmin(player)) {
|
||||
player.kickPlayer(ChatColor.RED + "Disconnected by admin.");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -13,21 +10,21 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Set a landmine trap.", usage = "/<command>")
|
||||
public class Command_landmine extends TFM_Command
|
||||
{
|
||||
public class Command_landmine extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!TFM_ConfigEntry.LANDMINES_ENABLED.getBoolean())
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.LANDMINES_ENABLED.getBoolean()) {
|
||||
playerMsg("The landmine is currently disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
if (!ConfigurationEntry.ALLOW_EXPLOSIONS.getBoolean()) {
|
||||
playerMsg("Explosions are currently disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -8,25 +8,21 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Show the last command that someone used.", usage = "/<command> <player>")
|
||||
public class Command_lastcmd extends TFM_Command
|
||||
{
|
||||
public class Command_lastcmd extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND);
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
final PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
|
||||
if (playerdata != null)
|
||||
{
|
|
@ -1,37 +1,33 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerRank;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i]", aliases = "who")
|
||||
public class Command_list extends TFM_Command
|
||||
{
|
||||
private static enum ListFilter
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length > 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TFM_Util.isFromHostConsole(sender.getName()))
|
||||
{
|
||||
if (Utilities.isFromHostConsole(sender.getName())) {
|
||||
final List<String> names = new ArrayList<String>();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -72,21 +68,21 @@ public class Command_list extends TFM_Command
|
|||
final List<String> names = new ArrayList<String>();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (listFilter == ListFilter.ADMINS && !TFM_AdminList.isSuperAdmin(player))
|
||||
if (listFilter == ListFilter.ADMINS && !AdminList.isSuperAdmin(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (listFilter == ListFilter.IMPOSTORS && !TFM_AdminList.isAdminImpostor(player))
|
||||
if (listFilter == ListFilter.IMPOSTORS && !AdminList.isAdminImpostor(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
names.add(TFM_PlayerRank.fromSender(player).getPrefix() + player.getName());
|
||||
names.add(PlayerRank.fromSender(player).getPrefix() + player.getName());
|
||||
}
|
||||
|
||||
onlineUsers.append("Connected ");
|
||||
onlineUsers.append(listFilter == Command_list.ListFilter.ADMINS ? "admins: " : "players: ");
|
||||
onlineUsers.append(listFilter == ListFilter.ADMINS ? "admins: " : "players: ");
|
||||
onlineUsers.append(StringUtils.join(names, ChatColor.WHITE + ", "));
|
||||
|
||||
if (senderIsConsole)
|
|
@ -1,16 +1,13 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Teleport to the spawn point for the current world.", usage = "/<command>", aliases = "worldspawn,gotospawn")
|
||||
public class Command_localspawn extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, 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() + "\".");
|
||||
return true;
|
|
@ -1,7 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -10,26 +10,21 @@ import org.bukkit.scheduler.BukkitTask;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@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 TFM_Command
|
||||
{
|
||||
public class Command_lockup extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Locking up all players", true);
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
Utilities.adminAction(sender.getName(), "Locking up all players", true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
startLockup(player);
|
||||
}
|
||||
playerMsg("Locked up all players.");
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unlocking all players", true);
|
||||
Utilities.adminAction(sender.getName(), "Unlocking all players", true);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
cancelLockup(player);
|
||||
|
@ -50,11 +45,11 @@ public class Command_lockup extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Locking up " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), "Locking up " + player.getName(), true);
|
||||
startLockup(player);
|
||||
playerMsg("Locked up " + player.getName() + ".");
|
||||
}
|
||||
|
@ -64,11 +59,11 @@ public class Command_lockup extends TFM_Command
|
|||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
|
||||
Utilities.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
|
||||
cancelLockup(player);
|
||||
playerMsg("Unlocked " + player.getName() + ".");
|
||||
}
|
||||
|
@ -85,7 +80,7 @@ public class Command_lockup extends TFM_Command
|
|||
return true;
|
||||
}
|
||||
|
||||
private void cancelLockup(TFM_PlayerData playerdata)
|
||||
private void cancelLockup(PlayerData playerdata)
|
||||
{
|
||||
BukkitTask lockupScheduleID = playerdata.getLockupScheduleID();
|
||||
if (lockupScheduleID != null)
|
||||
|
@ -97,12 +92,12 @@ public class Command_lockup extends TFM_Command
|
|||
|
||||
private void cancelLockup(final Player player)
|
||||
{
|
||||
cancelLockup(TFM_PlayerData.getPlayerData(player));
|
||||
cancelLockup(PlayerData.getPlayerData(player));
|
||||
}
|
||||
|
||||
private void startLockup(final Player player)
|
||||
{
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
final PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
|
||||
cancelLockup(playerdata);
|
||||
|
|
@ -1,18 +1,9 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -20,23 +11,19 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
||||
public class Command_logs extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.UPDATE;
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
public class Command_logs extends FreedomCommand {
|
||||
public static void deactivateSuperadmin(Admin superadmin) {
|
||||
for (String ip : superadmin.getIps()) {
|
||||
updateLogsRegistration(null, superadmin.getLastLoginName(), ip, LogsRegistrationMode.DELETE);
|
||||
}
|
||||
|
||||
updateLogsRegistration(sender, sender_p, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void updateLogsRegistration(final CommandSender sender, final Player target, final LogsRegistrationMode mode)
|
||||
|
@ -46,8 +33,8 @@ public class Command_logs extends TFM_Command
|
|||
|
||||
public static void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
|
||||
{
|
||||
final String logsRegisterURL = TFM_ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = TFM_ConfigEntry.LOGS_SECRET.getString();
|
||||
final String logsRegisterURL = ConfigurationEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = ConfigurationEntry.LOGS_SECRET.getString();
|
||||
|
||||
if (logsRegisterURL == null || logsRegisterPassword == null || logsRegisterURL.isEmpty() || logsRegisterPassword.isEmpty())
|
||||
{
|
||||
|
@ -99,21 +86,24 @@ public class Command_logs extends TFM_Command
|
|||
}
|
||||
}.runTask(TotalFreedomMod.plugin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
} catch (Exception ex) {
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}.runTaskAsynchronously(TotalFreedomMod.plugin);
|
||||
}
|
||||
|
||||
public static void deactivateSuperadmin(TFM_Admin superadmin)
|
||||
{
|
||||
for (String ip : superadmin.getIps())
|
||||
{
|
||||
updateLogsRegistration(null, superadmin.getLastLoginName(), ip, Command_logs.LogsRegistrationMode.DELETE);
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.UPDATE;
|
||||
|
||||
if (args.length == 1) {
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
}
|
||||
|
||||
updateLogsRegistration(sender, sender_p, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum LogsRegistrationMode
|
|
@ -0,0 +1,77 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.gamerule.GameRuleHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, 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 {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on")) {
|
||||
ConfigurationEntry.MOB_LIMITER_ENABLED.setBoolean(true);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("off"))
|
||||
{
|
||||
ConfigurationEntry.MOB_LIMITER_ENABLED.setBoolean(false);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("dragon"))
|
||||
{
|
||||
ConfigurationEntry.MOB_LIMITER_DISABLE_DRAGON.setBoolean(!ConfigurationEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("giant"))
|
||||
{
|
||||
ConfigurationEntry.MOB_LIMITER_DISABLE_GIANT.setBoolean(!ConfigurationEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("slime"))
|
||||
{
|
||||
ConfigurationEntry.MOB_LIMITER_DISABLE_SLIME.setBoolean(!ConfigurationEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("ghast"))
|
||||
{
|
||||
ConfigurationEntry.MOB_LIMITER_DISABLE_GHAST.setBoolean(!ConfigurationEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("setmax"))
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigurationEntry.MOB_LIMITER_MAX.setInteger(Math.max(0, Math.min(2000, Integer.parseInt(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigurationEntry.MOB_LIMITER_ENABLED.getBoolean())
|
||||
{
|
||||
sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + ConfigurationEntry.MOB_LIMITER_MAX.getInteger() + ".");
|
||||
|
||||
playerMsg("Dragon: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Giant: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Slime: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
playerMsg("Ghast: " + (ConfigurationEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Moblimiter is disabled. No mob restrictions are in effect.");
|
||||
}
|
||||
|
||||
GameRuleHandler.setGameRule(GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !ConfigurationEntry.MOB_LIMITER_ENABLED.getBoolean());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,24 +1,16 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Ambient;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>")
|
||||
public class Command_mp extends TFM_Command
|
||||
{
|
||||
public class Command_mp extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
playerMsg("Purging all mobs...");
|
||||
playerMsg(purgeMobs() + " mobs removed.");
|
||||
return true;
|
|
@ -1,33 +1,28 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.", usage = "/<command> <draw | sling>")
|
||||
public class Command_mp44 extends TFM_Command
|
||||
{
|
||||
public class Command_mp44 extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!TFM_ConfigEntry.MP44_ENABLED.getBoolean())
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.MP44_ENABLED.getBoolean()) {
|
||||
playerMsg("The mp44 is currently disabled.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(sender_p);
|
||||
|
||||
if (args[0].equalsIgnoreCase("draw"))
|
||||
{
|
|
@ -0,0 +1,15 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
|
||||
public class Command_nether extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.gotoWorld(sender_p, server.getWorlds().get(0).getName() + "_nether");
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,120 +1,117 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "NickFilter: Prefix any command with this command to replace nicknames in that command with real names. Nicknames should be prefixed with a !.", usage = "/<command> <other_command> !<playernick>")
|
||||
public class Command_nf extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
boolean nickMatched = false;
|
||||
|
||||
final List<String> outputCommand = new ArrayList<String>();
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
final List<String> argsList = Arrays.asList(args);
|
||||
for (String arg : argsList)
|
||||
{
|
||||
Player player = null;
|
||||
|
||||
Matcher matcher = Pattern.compile("^!(.+)$").matcher(arg);
|
||||
if (matcher.find())
|
||||
{
|
||||
String displayName = matcher.group(1);
|
||||
|
||||
player = getPlayerByDisplayName(displayName);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayerByDisplayNameAlt(displayName);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
outputCommand.add(arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
nickMatched = true;
|
||||
outputCommand.add(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!nickMatched)
|
||||
{
|
||||
sender.sendMessage("No nicknames replaced in command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String newCommand = StringUtils.join(outputCommand, " ");
|
||||
|
||||
if (TFM_CommandBlocker.isCommandBlocked(newCommand, sender))
|
||||
{
|
||||
// CommandBlocker handles messages and broadcasts
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage("Sending command: \"" + newCommand + "\".");
|
||||
server.dispatchCommand(sender, newCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Player getPlayerByDisplayName(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().trim().contains(needle))
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Player getPlayerByDisplayNameAlt(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
Integer minEditDistance = null;
|
||||
Player minEditMatch = null;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String haystack = player.getDisplayName().toLowerCase().trim();
|
||||
int editDistance = StringUtils.getLevenshteinDistance(needle, haystack.toLowerCase());
|
||||
if (minEditDistance == null || minEditDistance.intValue() > editDistance)
|
||||
{
|
||||
minEditDistance = editDistance;
|
||||
minEditMatch = player;
|
||||
}
|
||||
}
|
||||
|
||||
return minEditMatch;
|
||||
}
|
||||
}
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "NickFilter: Prefix any command with this command to replace nicknames in that command with real names. Nicknames should be prefixed with a !.", usage = "/<command> <other_command> !<playernick>")
|
||||
public class Command_nf extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
boolean nickMatched = false;
|
||||
|
||||
final List<String> outputCommand = new ArrayList<String>();
|
||||
|
||||
if (args.length >= 1) {
|
||||
final List<String> argsList = Arrays.asList(args);
|
||||
for (String arg : argsList) {
|
||||
Player player = null;
|
||||
|
||||
Matcher matcher = Pattern.compile("^!(.+)$").matcher(arg);
|
||||
if (matcher.find())
|
||||
{
|
||||
String displayName = matcher.group(1);
|
||||
|
||||
player = getPlayerByDisplayName(displayName);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = getPlayerByDisplayNameAlt(displayName);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
outputCommand.add(arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
nickMatched = true;
|
||||
outputCommand.add(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!nickMatched)
|
||||
{
|
||||
sender.sendMessage("No nicknames replaced in command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String newCommand = StringUtils.join(outputCommand, " ");
|
||||
|
||||
if (CommandBlocker.isCommandBlocked(newCommand, sender))
|
||||
{
|
||||
// CommandBlocker handles messages and broadcasts
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage("Sending command: \"" + newCommand + "\".");
|
||||
server.dispatchCommand(sender, newCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Player getPlayerByDisplayName(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().trim().contains(needle))
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Player getPlayerByDisplayNameAlt(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
Integer minEditDistance = null;
|
||||
Player minEditMatch = null;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String haystack = player.getDisplayName().toLowerCase().trim();
|
||||
int editDistance = StringUtils.getLevenshteinDistance(needle, haystack.toLowerCase());
|
||||
if (minEditDistance == null || minEditDistance.intValue() > editDistance)
|
||||
{
|
||||
minEditDistance = editDistance;
|
||||
minEditMatch = player;
|
||||
}
|
||||
}
|
||||
|
||||
return minEditMatch;
|
||||
}
|
||||
}
|
|
@ -1,46 +1,40 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Essentials Interface Command - Remove distracting things from nicknames of all players on server.", usage = "/<command>", aliases = "nc")
|
||||
public class Command_nickclean extends TFM_Command
|
||||
{
|
||||
public class Command_nickclean extends FreedomCommand {
|
||||
private static final ChatColor[] BLOCKED = new ChatColor[]
|
||||
{
|
||||
ChatColor.MAGIC,
|
||||
ChatColor.STRIKETHROUGH,
|
||||
ChatColor.ITALIC,
|
||||
ChatColor.UNDERLINE,
|
||||
ChatColor.BLACK
|
||||
};
|
||||
{
|
||||
ChatColor.MAGIC,
|
||||
ChatColor.STRIKETHROUGH,
|
||||
};
|
||||
private static final Pattern REGEX = Pattern.compile("\\u00A7[" + StringUtils.join(BLOCKED, "") + "]");
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning all nicknames.", false);
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Cleaning all nicknames.", false);
|
||||
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
for (final Player player : server.getOnlinePlayers()) {
|
||||
final String playerName = player.getName();
|
||||
final String nickName = TFM_EssentialsBridge.getNickname(playerName);
|
||||
if (nickName != null && !nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName))
|
||||
{
|
||||
final String nickName = EssentialsBridge.getNickname(playerName);
|
||||
if (nickName != null && !nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName)) {
|
||||
final Matcher matcher = REGEX.matcher(nickName);
|
||||
if (matcher.find())
|
||||
{
|
||||
final String newNickName = matcher.replaceAll("");
|
||||
playerMsg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
|
||||
TFM_EssentialsBridge.setNickname(playerName, newNickName);
|
||||
EssentialsBridge.setNickname(playerName, newNickName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -10,24 +10,20 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Nyanify your nickname.", usage = "/<command> <<nick> | off>")
|
||||
public class Command_nicknyan extends TFM_Command
|
||||
{
|
||||
public class Command_nicknyan 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ("off".equals(args[0]))
|
||||
{
|
||||
TFM_EssentialsBridge.setNickname(sender.getName(), null);
|
||||
if ("off".equals(args[0])) {
|
||||
EssentialsBridge.setNickname(sender.getName(), null);
|
||||
playerMsg("Nickname cleared.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final String nickPlain = ChatColor.stripColor(TFM_Util.colorize(args[0].trim()));
|
||||
final String nickPlain = ChatColor.stripColor(Utilities.colorize(args[0].trim()));
|
||||
|
||||
if (!nickPlain.matches("^[a-zA-Z_0-9\u00a7]+$"))
|
||||
{
|
||||
|
@ -58,12 +54,12 @@ public class Command_nicknyan extends TFM_Command
|
|||
final char[] chars = nickPlain.toCharArray();
|
||||
for (char c : chars)
|
||||
{
|
||||
newNick.append(TFM_Util.randomChatColor()).append(c);
|
||||
newNick.append(Utilities.randomChatColor()).append(c);
|
||||
}
|
||||
|
||||
newNick.append(ChatColor.WHITE);
|
||||
|
||||
TFM_EssentialsBridge.setNickname(sender.getName(), newNick.toString());
|
||||
EssentialsBridge.setNickname(sender.getName(), newNick.toString());
|
||||
|
||||
playerMsg("Your nickname is now: " + newNick.toString());
|
||||
|
|
@ -1,37 +1,32 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "AdminChat - Talk privately with other admins. Using <command> itself will toggle AdminChat on and off for all messages.",
|
||||
usage = "/<command> [message...]",
|
||||
aliases = "adminchat")
|
||||
public class Command_o extends TFM_Command
|
||||
{
|
||||
public class Command_o extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
if (senderIsConsole) {
|
||||
playerMsg("Only in-game players can toggle AdminChat.");
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData userinfo = TFM_PlayerData.getPlayerData(sender_p);
|
||||
PlayerData userinfo = PlayerData.getPlayerData(sender_p);
|
||||
userinfo.setAdminChat(!userinfo.inAdminChat());
|
||||
playerMsg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminChatMessage(sender, StringUtils.join(args, " "), senderIsConsole);
|
||||
Utilities.adminChatMessage(sender, StringUtils.join(args, " "), senderIsConsole);
|
||||
}
|
||||
|
||||
return true;
|
|
@ -1,9 +1,9 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Server;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -11,23 +11,18 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Switch server online-mode on and off.", usage = "/<command> <on | off>")
|
||||
public class Command_onlinemode extends TFM_Command
|
||||
{
|
||||
public class Command_onlinemode 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE);
|
||||
playerMsg("\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
boolean online_mode;
|
||||
|
||||
if (sender instanceof Player && !TFM_AdminList.isSeniorAdmin(sender, true))
|
||||
if (sender instanceof Player && !AdminList.isSeniorAdmin(sender, true))
|
||||
{
|
||||
playerMsg(TFM_Command.MSG_NO_PERMS);
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,7 +41,7 @@ public class Command_onlinemode extends TFM_Command
|
|||
|
||||
try
|
||||
{
|
||||
TFM_ServerInterface.setOnlineMode(online_mode);
|
||||
Server.setOnlineMode(online_mode);
|
||||
|
||||
if (online_mode)
|
||||
{
|
||||
|
@ -56,13 +51,13 @@ public class Command_onlinemode extends TFM_Command
|
|||
}
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Turning player validation " + (online_mode ? "on" : "off") + ".", true);
|
||||
Utilities.adminAction(sender.getName(), "Turning player validation " + (online_mode ? "on" : "off") + ".", true);
|
||||
|
||||
server.reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +1,55 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
|
||||
public class Command_op extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone"))
|
||||
{
|
||||
playerMsg("Correct usage: /opall");
|
||||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer player = null;
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
player = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("That player is not online.");
|
||||
playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false);
|
||||
player.setOp(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.DeprecationUtil;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
|
||||
public class Command_op extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone")) {
|
||||
playerMsg("Correct usage: /opall");
|
||||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer player = null;
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
player = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
if (AdminList.isSuperAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
player = DeprecationUtil.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("That player is not online.");
|
||||
playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Utilities.adminAction(sender.getName(), "Opping " + player.getName(), false);
|
||||
player.setOp(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -8,19 +8,15 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@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 TFM_Command
|
||||
{
|
||||
public class Command_opall extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false);
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Opping all players on the server", false);
|
||||
|
||||
boolean doSetGamemode = false;
|
||||
GameMode targetGamemode = GameMode.CREATIVE;
|
||||
if (args.length != 0)
|
||||
{
|
||||
if (args[0].equals("-c"))
|
||||
{
|
||||
if (args.length != 0) {
|
||||
if (args[0].equals("-c")) {
|
||||
doSetGamemode = true;
|
||||
targetGamemode = GameMode.CREATIVE;
|
||||
}
|
||||
|
@ -34,7 +30,7 @@ public class Command_opall extends TFM_Command
|
|||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.setOp(true);
|
||||
player.sendMessage(TFM_Command.YOU_ARE_OP);
|
||||
player.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
|
||||
if (doSetGamemode)
|
||||
{
|
|
@ -0,0 +1,18 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Automatically ops user.", usage = "/<command>")
|
||||
public class Command_opme extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||
sender.setOp(true);
|
||||
sender.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,65 +1,61 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
|
||||
public class Command_ops extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("count"))
|
||||
{
|
||||
int totalOps = server.getOperators().size();
|
||||
int onlineOps = 0;
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.isOp())
|
||||
{
|
||||
onlineOps++;
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg("Online OPs: " + onlineOps);
|
||||
playerMsg("Offline OPs: " + (totalOps - onlineOps));
|
||||
playerMsg("Total OPs: " + totalOps);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("purge"))
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TFM_Command.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Purging all operators", true);
|
||||
|
||||
for (OfflinePlayer player : server.getOperators())
|
||||
{
|
||||
player.setOp(false);
|
||||
if (player.isOnline())
|
||||
{
|
||||
playerMsg(player.getPlayer(), TFM_Command.YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
|
||||
public class Command_ops extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("count")) {
|
||||
int totalOps = server.getOperators().size();
|
||||
int onlineOps = 0;
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.isOp())
|
||||
{
|
||||
onlineOps++;
|
||||
}
|
||||
}
|
||||
|
||||
playerMsg("Online OPs: " + onlineOps);
|
||||
playerMsg("Offline OPs: " + (totalOps - onlineOps));
|
||||
playerMsg("Total OPs: " + totalOps);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("purge"))
|
||||
{
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
Utilities.adminAction(sender.getName(), "Purging all operators", true);
|
||||
|
||||
for (OfflinePlayer player : server.getOperators())
|
||||
{
|
||||
player.setOp(false);
|
||||
if (player.isOnline())
|
||||
{
|
||||
playerMsg(player.getPlayer(), FreedomCommand.YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -12,25 +12,21 @@ import org.bukkit.util.Vector;
|
|||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon!",
|
||||
usage = "/<command> <target> [<<power> | stop>]")
|
||||
public class Command_orbit extends TFM_Command
|
||||
{
|
||||
public class Command_orbit extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
if (player == null) {
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
|
||||
double strength = 10.0;
|
||||
|
||||
|
@ -58,7 +54,7 @@ public class Command_orbit extends TFM_Command
|
|||
playerdata.startOrbiting(strength);
|
||||
|
||||
player.setVelocity(new Vector(0, strength, 0));
|
||||
TFM_Util.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
|
||||
Utilities.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,32 +1,27 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import com.sk89q.util.StringUtil;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.config.MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
|
||||
public class Command_overlord extends TFM_Command
|
||||
{
|
||||
public class Command_overlord extends FreedomCommand {
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!TFM_ConfigEntry.OVERLORD_IPS.getList().contains(TFM_Util.getIp(sender_p)))
|
||||
{
|
||||
try
|
||||
{
|
||||
List<?> ips = (List) TFM_MainConfig.getDefaults().get(TFM_ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (!ips.contains(TFM_Util.getIp(sender_p)))
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.OVERLORD_IPS.getList().contains(Utilities.getIp(sender_p))) {
|
||||
try {
|
||||
List<?> ips = (List) MainConfig.getDefaults().get(ConfigurationEntry.OVERLORD_IPS.getConfigName());
|
||||
if (!ips.contains(Utilities.getIp(sender_p))) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
@ -44,14 +39,14 @@ public class Command_overlord extends TFM_Command
|
|||
|
||||
if (args[0].equals("addme"))
|
||||
{
|
||||
TFM_AdminList.addSuperadmin(sender_p);
|
||||
AdminList.addSuperadmin(sender_p);
|
||||
playerMsg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("removeme"))
|
||||
{
|
||||
TFM_AdminList.removeSuperadmin(sender_p);
|
||||
AdminList.removeSuperadmin(sender_p);
|
||||
playerMsg("ok");
|
||||
return true;
|
||||
}
|
|
@ -1,37 +1,32 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PermbanList;
|
||||
import me.StevenLawson.TotalFreedomMod.ban.PermbanList;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> <list | reload>")
|
||||
public class Command_permban extends TFM_Command
|
||||
{
|
||||
public class Command_permban 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
dumplist(sender);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("reload"))
|
||||
{
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TFM_Command.MSG_NO_PERMS);
|
||||
sender.sendMessage(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
playerMsg("Reloading permban list...", ChatColor.RED);
|
||||
TFM_PermbanList.load();
|
||||
PermbanList.load();
|
||||
dumplist(sender);
|
||||
}
|
||||
else
|
||||
|
@ -44,24 +39,24 @@ public class Command_permban extends TFM_Command
|
|||
|
||||
private void dumplist(CommandSender sender)
|
||||
{
|
||||
if (TFM_PermbanList.getPermbannedPlayers().isEmpty())
|
||||
if (PermbanList.getPermbannedPlayers().isEmpty())
|
||||
{
|
||||
playerMsg("No permanently banned player names.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(TFM_PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
|
||||
playerMsg(StringUtils.join(TFM_PermbanList.getPermbannedPlayers(), ", "));
|
||||
playerMsg(PermbanList.getPermbannedPlayers().size() + " permanently banned players:");
|
||||
playerMsg(StringUtils.join(PermbanList.getPermbannedPlayers(), ", "));
|
||||
}
|
||||
|
||||
if (TFM_PermbanList.getPermbannedIps().isEmpty())
|
||||
if (PermbanList.getPermbannedIps().isEmpty())
|
||||
{
|
||||
playerMsg("No permanently banned IPs.");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(TFM_PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
|
||||
playerMsg(StringUtils.join(TFM_PermbanList.getPermbannedIps(), ", "));
|
||||
playerMsg(PermbanList.getPermbannedIps().size() + " permanently banned IPs:");
|
||||
playerMsg(StringUtils.join(PermbanList.getPermbannedIps(), ", "));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +1,24 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
||||
public class Command_plugincontrol extends TFM_Command
|
||||
{
|
||||
public class Command_plugincontrol extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 0 || args.length > 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
for (Plugin serverPlugin : pm.getPlugins())
|
|
@ -1,9 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.admin.AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -12,24 +10,21 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Manipulate potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
||||
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>")
|
||||
public class Command_potion extends TFM_Command
|
||||
{
|
||||
public class Command_potion extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 1 || args.length == 2)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length == 1 || args.length == 2) {
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
List<String> potionEffectTypeNames = new ArrayList<String>();
|
||||
for (PotionEffectType potion_effect_type : PotionEffectType.values())
|
||||
{
|
||||
if (potion_effect_type != null)
|
||||
{
|
||||
for (PotionEffectType potion_effect_type : PotionEffectType.values()) {
|
||||
if (potion_effect_type != null) {
|
||||
potionEffectTypeNames.add(potion_effect_type.getName());
|
||||
}
|
||||
}
|
||||
|
@ -37,12 +32,12 @@ public class Command_potion extends TFM_Command
|
|||
}
|
||||
else if (args[0].equalsIgnoreCase("clearall"))
|
||||
{
|
||||
if (!(TFM_AdminList.isSuperAdmin(sender) || senderIsConsole))
|
||||
if (!(AdminList.isSuperAdmin(sender) || senderIsConsole))
|
||||
{
|
||||
playerMsg(TFM_Command.MSG_NO_PERMS);
|
||||
playerMsg(FreedomCommand.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
TFM_Util.adminAction(sender.getName(), "Cleared all potion effects from all players", true);
|
||||
Utilities.adminAction(sender.getName(), "Cleared all potion effects from all players", true);
|
||||
for (Player target : server.getOnlinePlayers())
|
||||
{
|
||||
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
||||
|
@ -61,14 +56,14 @@ public class Command_potion extends TFM_Command
|
|||
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(sender_p))
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg("Only superadmins can clear potion effects from other players.");
|
||||
return true;
|
||||
|
@ -105,14 +100,14 @@ public class Command_potion extends TFM_Command
|
|||
|
||||
if (target == null)
|
||||
{
|
||||
playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(sender_p))
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
if (!AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
sender.sendMessage("Only superadmins can apply potion effects to other players.");
|
||||
return true;
|
|
@ -1,25 +1,23 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.Log;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Validates if a given account is premium.", usage = "/<command> <player>", aliases = "prem")
|
||||
public class Command_premium extends TFM_Command
|
||||
{
|
||||
public class Command_premium 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,7 +59,7 @@ public class Command_premium extends TFM_Command
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
Log.severe(ex);
|
||||
playerMsg("There was an error querying the mojang server.", ChatColor.RED);
|
||||
}
|
||||
}
|
|
@ -1,37 +1,32 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.config.ConfigurationEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.world.ProtectedArea;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(
|
||||
description = "Protect areas so that only superadmins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.",
|
||||
usage = "/<command> <list | clear | remove <label> | add <label> <radius>>")
|
||||
public class Command_protectarea extends TFM_Command
|
||||
{
|
||||
public class Command_protectarea extends FreedomCommand {
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||
{
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigurationEntry.PROTECTAREA_ENABLED.getBoolean()) {
|
||||
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
playerMsg("Protected Areas: " + StringUtils.join(TFM_ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
playerMsg("Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("clear"))
|
||||
{
|
||||
TFM_ProtectedArea.clearProtectedAreas();
|
||||
ProtectedArea.clearProtectedAreas();
|
||||
|
||||
playerMsg("Protected Areas Cleared.");
|
||||
}
|
||||
|
@ -46,9 +41,9 @@ public class Command_protectarea extends TFM_Command
|
|||
{
|
||||
if ("remove".equals(args[0]))
|
||||
{
|
||||
TFM_ProtectedArea.removeProtectedArea(args[1]);
|
||||
ProtectedArea.removeProtectedArea(args[1]);
|
||||
|
||||
playerMsg("Area removed. Protected Areas: " + StringUtils.join(TFM_ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
playerMsg("Area removed. Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -78,15 +73,15 @@ public class Command_protectarea extends TFM_Command
|
|||
return true;
|
||||
}
|
||||
|
||||
if (radius > TFM_ProtectedArea.MAX_RADIUS || radius < 0.0D)
|
||||
if (radius > ProtectedArea.MAX_RADIUS || radius < 0.0D)
|
||||
{
|
||||
playerMsg("Invalid radius. Radius must be a positive value less than " + TFM_ProtectedArea.MAX_RADIUS + ".");
|
||||
playerMsg("Invalid radius. Radius must be a positive value less than " + ProtectedArea.MAX_RADIUS + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_ProtectedArea.addProtectedArea(args[1], sender_p.getLocation(), radius);
|
||||
ProtectedArea.addProtectedArea(args[1], sender_p.getLocation(), radius);
|
||||
|
||||
playerMsg("Area added. Protected Areas: " + StringUtils.join(TFM_ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
playerMsg("Area added. Protected Areas: " + StringUtils.join(ProtectedArea.getProtectedAreaLabels(), ", "));
|
||||
}
|
||||
else
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -9,19 +9,16 @@ import org.bukkit.potion.PotionEffect;
|
|||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
|
||||
public class Command_purgeall extends TFM_Command
|
||||
{
|
||||
public class Command_purgeall extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Purging all player data", true);
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Purging all player data", true);
|
||||
|
||||
// Purge entities
|
||||
TFM_Util.TFM_EntityWiper.wipeEntities(true, true);
|
||||
Utilities.TFM_EntityWiper.wipeEntities(true, true);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
PlayerData playerdata = PlayerData.getPlayerData(player);
|
||||
|
||||
// Unmute all players
|
||||
if (playerdata.isMuted())
|
|
@ -1,28 +1,25 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quick De-Op - deop someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qdeop extends TFM_Command
|
||||
{
|
||||
public class Command_qdeop 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (args.length == 2) {
|
||||
silent = args[1].equalsIgnoreCase("-s");
|
||||
}
|
||||
|
||||
|
@ -37,7 +34,7 @@ public class Command_qdeop extends TFM_Command
|
|||
{
|
||||
matchedPlayerNames.add(player.getName());
|
||||
player.setOp(false);
|
||||
player.sendMessage(TFM_Command.YOU_ARE_NOT_OP);
|
||||
player.sendMessage(FreedomCommand.YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +43,7 @@ public class Command_qdeop extends TFM_Command
|
|||
{
|
||||
if (!silent)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
||||
Utilities.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
||||
}
|
||||
}
|
||||
else
|
|
@ -1,28 +1,25 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
|
||||
public class Command_qop extends TFM_Command
|
||||
{
|
||||
public class Command_qop 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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (args.length == 2) {
|
||||
silent = args[1].equalsIgnoreCase("-s");
|
||||
}
|
||||
|
||||
|
@ -37,7 +34,7 @@ public class Command_qop extends TFM_Command
|
|||
{
|
||||
matchedPlayerNames.add(player.getName());
|
||||
player.setOp(true);
|
||||
player.sendMessage(TFM_Command.YOU_ARE_OP);
|
||||
player.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +43,7 @@ public class Command_qop extends TFM_Command
|
|||
{
|
||||
if (!silent)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
||||
Utilities.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
||||
}
|
||||
}
|
||||
else
|
|
@ -1,30 +1,27 @@
|
|||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Shows nearby people sorted by distance.", usage = "/<command> [range]")
|
||||
public class Command_radar extends TFM_Command
|
||||
{
|
||||
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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Location sender_pos = sender_p.getLocation();
|
||||
|
||||
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
|
||||
|
||||
for (Player player : sender_pos.getWorld().getPlayers())
|
||||
{
|
||||
if (!player.equals(sender_p))
|
||||
{
|
||||
for (Player player : sender_pos.getWorld().getPlayers()) {
|
||||
if (!player.equals(sender_p)) {
|
||||
try
|
||||
{
|
||||
radar_data.add(new TFM_RadarData(player, sender_pos.distance(player.getLocation()), player.getLocation()));
|
|
@ -0,0 +1,44 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.player.PlayerRank;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows your rank.", usage = "/<command>")
|
||||
public class Command_rank extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (senderIsConsole && args.length < 1) {
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
playerMsg(player.getName() + " is " + PlayerRank.fromSender(player).getLoginMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
playerMsg(sender.getName() + " is " + PlayerRank.fromSender(sender).getLoginMessage(), ChatColor.AQUA);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg(player.getName() + " is " + PlayerRank.fromSender(player).getLoginMessage(), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
|
||||
public class Command_rawsay extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length > 0) {
|
||||
Utilities.bcastMsg(Utilities.colorize(StringUtils.join(args, " ")));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package me.StevenLawson.TotalFreedomMod.commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.util.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@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, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
Utilities.adminAction(sender.getName(), "Removing all server entities.", true);
|
||||
playerMsg((Utilities.TFM_EntityWiper.wipeEntities(true, true)) + " entities removed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue