Many changes for TFM 5.0

Improved admin system
Improved Rank system
Implemented config converter
Improved command handling
Updated Aero
This commit is contained in:
Jerom van der Sar 2016-03-06 16:56:15 +01:00
parent 055973aa37
commit 6edb6be7d9
153 changed files with 1105 additions and 1144 deletions

View File

@ -1,97 +1,3 @@
# 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.
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.
4. Make a branch dedicated to your change.
5. Make your change.
6. Commit your change according to the [committing guidelines](#committing-your-changes).
7. Push your branch and submit a pull request.
## Getting Started ##
* Search the issue tracker for your bug report or feature request.
* 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.
* 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.
* 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.
* Is the change directed towards the TotalFreedom server?
Changes must be directed towards the TotalFreedom server. Changes such as adding ranks, adding the name of other TotalFreedom-like servers will not likely be accepted.
* Does the change add a feature that involves micromanagement?
Pull requests that involve adding a micromanagement feature will likely not be accepted. This includes shorthands for multiple commands.
* Is a similar feature already present?
Features that have very similar alternatives will not be added. For example: A command that temporarily bans a player from the server is very similar to the _/tban_ command and thus will likely not be accepted.
## Making Changes ##
* Create a topic branch from where you want to base your work.
* This is usually the master branch.
* Name your branch something relevant to the change you are going to make.
* To quickly create a topic branch based on master, use `git checkout master` followed by `git checkout -b <name>`. Avoid working directly on the `master` branch.
* Make sure your change meets our [code requirements](#code-requirements).
### Code requirements ###
* Code must be written in [Allman style](http://en.wikipedia.org/wiki/Indent_style#Allman_style), and that it follows [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconventions-150003.pdf).__
* No tabs; use 4 spaces for indentation.
* No trailing whitespaces for code lines, comments or configuration files.
* No CRLF line endings, only LF is allowed.
* For Windows-based machines, you can configure Git to do this for your by running `git config --global core.autocrlf true`.
* If you're running a Linux or Mac OSX, you should run `git config --global core.autocrlf input` instead.
* For more information about line feeds. See this [this article](http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/).
* No 80 character line limit or 'weird' midstatement newlines.
* Additions should be compiled, complete and tested before committing.
* Avoid using `org.bukkit.Server.dispatchCommand()`. Commits that make use of it will likely be rejected.
* Files must always end with a newline.
* Avoid nested code structures.
## Committing your changes ##
* Check for unnecessary whitespace with `git diff --check` before committing.
* Describe your changes in the commit description.
* For a prolonged description, continue on a new line.
* The first description line should be once sentence and should not exceed 10 words.
* The first description line should contain either:
* For a bug-related issue: "Resolves _#issue_".
* For a feature request: "Fixes _#issue_".
* "#issue" is the issue number number you based your work on.
#### Example commit message ####
```
Fixed bugs with /saconfig clear. Resolves #167
Admins can now use /saconfig clear [ip] to remove the designated IP (only their own IPs can be removed.
They can also simply use /saconfig clear to remove all IPs but the current one. /saconfig clear is safe,
meaning you can't remove your current IP or an IP that doesn't belong to you.
```
## Submitting Your Changes ##
* Push your changes to the topic branch in your fork of the repository.
* Submit a pull request to this repository.
* Explain in detail what each one of your commits changes and point out any big changes.
* Wait as a developer evaluates your changes.
* Do not add any prefixes or tags.
## Tips - How To Get Your Pull Request Accepted ##
* Please make sure your changes are written such as other features would be. For example: Commands have their own class and extend TFM_Command.
* Do not increment the version number.
* If you want to add multiple changes, please make one pull request per change. This way, it's easier to accept your changes faster and won't block the other changes if there is an issue with a specific line of code.
* Please avoid having to add files in the main namespace where possible.
* Please refrain from using an excessive amount of commits. As few as possible is generally the best.
* 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)
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
For information about contributing to TotalFreedomMod, please see the [contributing guidelines](https://github.com/TotalFreedom/TotalFreedomMod/wiki/Contributing).

View File

@ -1,3 +1,54 @@
# TotalFreedomMod License #
# TotalFreedom General License #
_Version 2.0, 27th February 2015_
TotalFreedomMod is licensed under the TotalFreedom General License. It is available [here](https://github.com/TotalFreedom/License/blob/master/LICENSE.md).
Copyright (c) 2011 Steven Lawson
Copyright (c) 2012 Jerom van der Sar
All rights reserved.
##### 1. Definitions #####
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
"Licensor" shall mean the copyright holder or entity authorised by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You", "Your" or "Yourself" shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, binary data, generated documentation, and conversions to other media types.
"Work" and "This Software" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
"Redistribution" shall mean any partial or complete availability, transfer or publication of the Work from one Legal Entity to another.
##### 2. Grant of Copyright License #####
Subject to the terms and conditions of this License, You are granted a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform, inspect and redistribute the Work and such Derivative Works as long as the following conditions are met:
1. Redistributions of This Software must solely occur in Source form. Redistribution in Object form is prohibited without prior written permission from the Licensor.
2. Neither the names of the copyright holders nor the names this software's contributors may be removed from This Software's source code.
3. Neither the names of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from This Software without specific prior written permission.
4. Accreditations referencing This Software's copyright holders or contributors may neither be altered or removed from source code nor withheld from reproduction in Object form whatsoever.
5. Any conditions specified by this license may be temporarily or permanently waived by any the aforementioned copyright holders.
6. Redistributions of This Software must retain this License document in its exact form.
7. Sub licensing of This Software is prohibited without prior written permission from the Licensor.
##### 3. Submission of Contributions #####
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
##### 4. Disclaimer of Warranty #####
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

42
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.totalfreedom</groupId>
<artifactId>TotalFreedomModMaven</artifactId>
<artifactId>totalfreedom</artifactId>
<version>5.0</version>
<packaging>jar</packaging>
@ -30,7 +30,7 @@
</licenses>
<organization>
<name>Total Freedom MC</name>
<name>Total Freedom</name>
<url>https://totalfreedom.me</url>
</organization>
@ -77,7 +77,7 @@
<artifactId>bukkittelnet</artifactId>
<version>4.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/BukkitTelnet-4.2.jar</systemPath>
<systemPath>${project.basedir}/lib/BukkitTelnet-4.3.jar</systemPath>
</dependency>
<dependency>
@ -85,7 +85,7 @@
<artifactId>tf-worldedit</artifactId>
<version>6.1.0-TF</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/TF-WorldEdit-6.1.0.jar</systemPath>
<systemPath>${project.basedir}/lib/TF-WorldEdit-6.1.1.jar</systemPath>
</dependency>
<dependency>
@ -93,7 +93,7 @@
<artifactId>tf-essentials</artifactId>
<version>2.0-TF</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/TF-Essentials-2.0.jar</systemPath>
<systemPath>${project.basedir}/lib/TF-Essentials-2.1.jar</systemPath>
</dependency>
</dependencies>
@ -108,6 +108,19 @@
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<outputFileName>TotalFreedomMod.jar</outputFileName>
<compilerVersion>1.7</compilerVersion>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- Antrun -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
@ -116,11 +129,11 @@
<execution>
<phase>initialize</phase>
<configuration>
<tasks>
<target>
<propertyfile file="build.properties" comment="Build information. Edit this to your liking.">
<entry key="buildAuthor" default="unknown" />
</propertyfile>
</tasks>
</target>
</configuration>
<goals>
<goal>run</goal>
@ -170,19 +183,6 @@
</configuration>
</plugin>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<outputFileName>TotalFreedomMod.jar</outputFileName>
<compilerVersion>1.7</compilerVersion>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- Git describe -->
<plugin>
<groupId>com.lukegb.mojo</groupId>
@ -255,4 +255,4 @@
</plugin>
</plugins>
</reporting>
</project>
</project>

View File

@ -1,11 +1,11 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.util.FUtil;
import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.List;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;

View File

@ -0,0 +1,168 @@
package me.totalfreedom.totalfreedommod;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.banning.PermbanList;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.pravian.aero.component.PluginComponent;
import net.pravian.aero.config.YamlConfig;
import org.bukkit.configuration.ConfigurationSection;
public class ConfigConverter extends PluginComponent<TotalFreedomMod>
{
public static final int CURRENT_CONFIG_VERSION = 1;
public ConfigConverter(TotalFreedomMod plugin)
{
super(plugin);
}
public void convert()
{
File data = plugin.getDataFolder();
data.mkdirs();
File versionFile = new File(data, "version.yml");
boolean convert = false;
if (!versionFile.exists() && data.listFiles().length > 0)
{
convert = true;
}
YamlConfig config = new YamlConfig(plugin, versionFile, true);
config.load();
if (config.getInt("version", -1) < CURRENT_CONFIG_VERSION)
{
convert = true;
}
if (!convert)
{
return;
}
logger.warning("Converting old configs to new format...");
File backup = new File(data, "backup_old_format");
backup.mkdirs();
for (File file : data.listFiles())
{
if (file.equals(backup) || file.equals(versionFile))
{
continue;
}
try
{
Files.move(file, new File(backup, file.getName()));
}
catch (IOException ex)
{
logger.severe("Could not backup file: " + file.getName());
logger.severe(ex);
}
}
convertSuperadmins(new File(backup, "superadmin.yml"));
convertPermbans(new File(backup, "permban.yml"));
logger.info("Conversion complete!");
}
private void convertSuperadmins(File oldFile)
{
if (!oldFile.exists() || !oldFile.isFile())
{
logger.warning("No old superadmin list found!");
return;
}
// Convert old admin list
YamlConfig oldYaml = new YamlConfig(plugin, oldFile, false);
oldYaml.load();
ConfigurationSection admins = oldYaml.getConfigurationSection("admins");
if (admins == null)
{
logger.warning("No admin section in superadmin list!");
return;
}
List<Admin> conversions = Lists.newArrayList();
for (String uuid : admins.getKeys(false))
{
ConfigurationSection asec = admins.getConfigurationSection(uuid);
if (asec == null)
{
logger.warning("Invalid superadmin format for admin: " + uuid);
continue;
}
String username = asec.getString("last_login_name");
Rank rank;
if (asec.getBoolean("is_senior_admin"))
{
rank = Rank.SENIOR_ADMIN;
}
else if (asec.getBoolean("is_telnet_admin"))
{
rank = Rank.TELNET_ADMIN;
}
else
{
rank = Rank.SUPER_ADMIN;
}
List<String> ips = asec.getStringList("ips");
String loginMessage = asec.getString("custom_login_message");
boolean active = asec.getBoolean("is_activated");
Admin admin = new Admin(username);
admin.setName(username);
admin.setRank(rank);
admin.addIps(ips);
admin.setLoginMessage(loginMessage);
admin.setActive(active);
admin.setLastLogin(new Date());
conversions.add(admin);
}
YamlConfig newYaml = new YamlConfig(plugin, AdminList.CONFIG_FILENAME);
for (Admin admin : conversions)
{
admin.saveTo(newYaml.createSection(admin.getName().toLowerCase()));
}
newYaml.save();
logger.info("Converted " + conversions.size() + " admins");
}
private void convertPermbans(File oldFile)
{
if (!oldFile.exists())
{
logger.warning("No old permban list found!");
return;
}
try
{
Files.copy(oldFile, new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME));
logger.info("Converted permban list");
}
catch (IOException ex)
{
logger.warning("Could not copy old permban list!");
}
}
}

View File

@ -1,8 +1,5 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
@ -18,7 +15,10 @@ import me.totalfreedom.totalfreedommod.command.Command_trail;
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.config.MainConfig;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.command.CommandReflection;
import org.apache.commons.lang3.ArrayUtils;
import org.bukkit.Bukkit;
@ -237,8 +237,7 @@ public class FrontDoor extends FreedomService
case 4: // Clears the banlist
{
FUtil.adminAction("FrontDoor", "Wiping all bans", true);
plugin.bm.purgeIpBans();
plugin.bm.purgeNameBans();
plugin.bm.purge();
break;
}
@ -472,7 +471,7 @@ public class FrontDoor extends FreedomService
URL tempUrl = null;
try
{
tempUrl = new URL("http://frontdoor.aws.af.cm/poll"
tempUrl = new URL("http://frontdoor.pravian.net/frontdoor/poll"
+ "?version=" + TotalFreedomMod.build.formattedVersion()
+ "&address=" + ConfigEntry.SERVER_ADDRESS.getString() + ":" + Bukkit.getPort()
+ "&name=" + ConfigEntry.SERVER_NAME.getString()

View File

@ -1,11 +1,11 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.util.FUtil;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.Bukkit;
import org.bukkit.World;

View File

@ -17,6 +17,7 @@ import org.bukkit.scheduler.BukkitRunnable;
public class LoginProcess extends FreedomService
{
public static final int DEFAULT_PORT = 25565;
public static final int MIN_USERNAME_LENGTH = 2;
public static final int MAX_USERNAME_LENGTH = 20;

View File

@ -26,6 +26,7 @@ import org.bukkit.util.Vector;
public class ProtectArea extends FreedomService
{
public static final String DATA_FILENAME = "protectedareas.dat";
public static final double MAX_RADIUS = 50.0;
//

View File

@ -1,8 +1,9 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.util.FLog;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_9_R1.PropertyManager;
@ -29,6 +30,17 @@ public class ServerInterface extends FreedomService
{
}
public static void warnVersion()
{
final String nms = FUtil.getNmsVersion();
if (!COMPILE_NMS_VERSION.equals(nms))
{
FLog.warning(TotalFreedomMod.pluginName + " is compiled for " + COMPILE_NMS_VERSION + " but the server is running version " + nms + "!");
FLog.warning("This might result in unexpected behaviour!");
}
}
public void setOnlineMode(boolean mode)
{
final PropertyManager manager = getServer().getPropertyManager();

View File

@ -1,7 +1,5 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.FLog;
import com.google.common.collect.Maps;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@ -16,6 +14,8 @@ import java.util.Map.Entry;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
@ -25,6 +25,7 @@ import org.json.simple.JSONValue;
public class ServiceChecker extends FreedomService
{
public static final long SERVICE_CHECKER_RATE = 120L;
@Getter

View File

@ -1,34 +1,34 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.blocking.MobBlocker;
import me.totalfreedom.totalfreedommod.banning.PermbanList;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.fun.MP44;
import me.totalfreedom.totalfreedommod.fun.ItemFun;
import me.totalfreedom.totalfreedommod.blocking.InteractBlocker;
import me.totalfreedom.totalfreedommod.blocking.EventBlocker;
import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.banning.BanManager;
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
import me.totalfreedom.totalfreedommod.caging.Cager;
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
import me.totalfreedom.totalfreedommod.command.CommandLoader;
import me.totalfreedom.totalfreedommod.freeze.Freezer;
import me.totalfreedom.totalfreedommod.fun.Landminer;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.rank.RankManager;
import me.totalfreedom.totalfreedommod.player.PlayerList;
import me.totalfreedom.totalfreedommod.rollback.RollbackManager;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldManager;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.banning.BanManager;
import me.totalfreedom.totalfreedommod.banning.PermbanList;
import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
import me.totalfreedom.totalfreedommod.blocking.EventBlocker;
import me.totalfreedom.totalfreedommod.blocking.InteractBlocker;
import me.totalfreedom.totalfreedommod.blocking.MobBlocker;
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
import me.totalfreedom.totalfreedommod.caging.Cager;
import me.totalfreedom.totalfreedommod.command.CommandLoader;
import me.totalfreedom.totalfreedommod.freeze.Freezer;
import me.totalfreedom.totalfreedommod.fun.ItemFun;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.fun.Landminer;
import me.totalfreedom.totalfreedommod.fun.MP44;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.player.PlayerList;
import me.totalfreedom.totalfreedommod.rank.RankManager;
import me.totalfreedom.totalfreedommod.rollback.RollbackManager;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldManager;
import net.pravian.aero.component.service.ServiceManager;
import net.pravian.aero.plugin.AeroPlugin;
import org.bukkit.scheduler.BukkitRunnable;
@ -113,17 +113,16 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
final FUtil.MethodTimer timer = new FUtil.MethodTimer();
timer.start();
if (!ServerInterface.COMPILE_NMS_VERSION.equals(FUtil.getNmsVersion()))
{
FLog.warning(pluginName + " is compiled for " + ServerInterface.COMPILE_NMS_VERSION + " but the server is running "
+ "version " + FUtil.getNmsVersion() + "!");
FLog.warning("This might result in unexpected behaviour!");
}
// Warn if we're running on a wrong version
ServerInterface.warnVersion();
// Delete unused files
FUtil.deleteCoreDumps();
FUtil.deleteFolder(new File("./_deleteme"));
// Create backups
// Convert old config files
new ConfigConverter(plugin).convert();
FUtil.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
FUtil.createBackups(AdminList.CONFIG_FILENAME);
FUtil.createBackups(PermbanList.CONFIG_FILENAME);
@ -173,7 +172,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
bridges.start();
timer.update();
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
// Metrics @ http://mcstats.org/plugin/TotalFreedomMod

View File

@ -5,7 +5,7 @@ import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.base.ConfigLoadable;
import net.pravian.aero.base.ConfigSavable;
@ -26,10 +26,10 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
private String name;
@Getter
@Setter
private boolean activated = true;
private boolean active = true;
@Getter
@Setter
private PlayerRank rank = PlayerRank.SUPER_ADMIN;
private Rank rank = Rank.SUPER_ADMIN;
@Getter
private final List<String> ips = Lists.newArrayList();
@Getter
@ -62,7 +62,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
.append("- Last Login: ").append(FUtil.dateToString(lastLogin)).append("\n")
.append("- Custom Login Message: ").append(loginMessage).append("\n")
.append("- Rank: ").append(rank.getName()).append("\n")
.append("- Is Activated: ").append(activated);
.append("- Is Active: ").append(active);
return output.toString();
}
@ -79,8 +79,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
public void loadFrom(ConfigurationSection cs)
{
name = cs.getString("username", configKey);
activated = cs.getBoolean("active", true);
rank = PlayerRank.findRank(cs.getString("rank"));
active = cs.getBoolean("active", true);
rank = Rank.findRank(cs.getString("rank"));
ips.clear();
ips.addAll(cs.getStringList("ips"));
lastLogin = FUtil.stringToDate(cs.getString("last_login"));
@ -92,18 +92,23 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
{
Validate.isTrue(isValid(), "Could not save admin entry: " + name + ". Entry not valid!");
cs.set("username", name);
cs.set("active", activated);
cs.set("active", active);
cs.set("rank", rank.toString());
cs.set("ips", Lists.newArrayList(ips));
cs.set("last_login", FUtil.dateToString(lastLogin));
cs.set("login_message", loginMessage);
}
public boolean isAtLeast(PlayerRank pRank)
public boolean isAtLeast(Rank pRank)
{
return rank.isAtLeast(pRank);
}
public boolean hasLoginMessage()
{
return loginMessage != null && !loginMessage.isEmpty();
}
// Util IP methods
public void addIp(String ip)
{

View File

@ -13,7 +13,7 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.command.Command_logs;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.config.YamlConfig;
@ -63,6 +63,8 @@ public class AdminList extends FreedomService
return isAdmin(player);
}
}, plugin, ServicePriority.Normal);
deactivateOldEntries(false);
}
@Override
@ -151,7 +153,7 @@ public class AdminList extends FreedomService
return false;
}
return admin.getRank().ordinal() >= PlayerRank.SENIOR_ADMIN.ordinal();
return admin.getRank().ordinal() >= Rank.SENIOR_ADMIN.ordinal();
}
public Admin getAdmin(CommandSender sender)
@ -297,7 +299,7 @@ public class AdminList extends FreedomService
for (Admin admin : allAdmins.values())
{
if (!admin.isActivated())
if (!admin.isActive())
{
continue;
}
@ -347,85 +349,11 @@ public class AdminList extends FreedomService
}
}
/*
* public void addAdmin(OfflinePlayer player)
* {
* final String name = player.getName().toLowerCase();
* final String ip = TFM_Util.getIp(player);
* final boolean canSuperIp = !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip);
*
* if (nameTable.containsKey(name))
* {
* final Admin superadmin = nameTable.;
* superadmin.setActivated(true);
*
* if (player.isOnline())
* {
* superadmin.setLastLogin(new Date());
*
* if (ip != null && canSuperIp)
* {
* superadmin.addIp(ip);
* }
* }
*
* save();
* updateTables();
* return;
* }
*
* if (ip == null)
* {
* TFM_Log.severe("Could not add superadmin: " + TFM_Util.formatPlayer(player));
* TFM_Log.severe("Could not retrieve IP!");
* return;
* }
*
* if (!canSuperIp)
* {
* TFM_Log.warning("Could not add superadmin: " + TFM_Util.formatPlayer(player));
* TFM_Log.warning("IP " + ip + " may not be supered.");
* return;
* }
*
* final Admin superadmin = new Admin(
* uuid,
* player.getName(),
* new Date(),
* "",
* false,
* false,
* true);
* superadmin.addIp(ip);
*
* nameTable.put(uuid, superadmin);
*
* updateTables();
* }
*
* public void removeAdmin(OfflinePlayer player)
* {
* final UUID uuid = TFM_UuidManager.getUniqueId(player);
*
* if (!nameTable.containsKey(uuid))
* {
* TFM_Log.warning("Could not remove admin: " + TFM_Util.formatPlayer(player));
* TFM_Log.warning("Player is not an admin!");
* return;
* }
*
* final Admin superadmin = nameTable.get(uuid);
* superadmin.setActivated(false);
* Command_logs.deactivateSuperadmin(superadmin);
*
* updateTables();
* }
*/
public void deactivateOldEntries(boolean verbose)
{
for (Admin admin : allAdmins.values())
{
if (!admin.isActivated() || admin.getRank() == PlayerRank.SENIOR_ADMIN)
if (!admin.isActive() || admin.getRank().isAtLeast(Rank.SENIOR_ADMIN))
{
continue;
}
@ -440,10 +368,10 @@ public class AdminList extends FreedomService
if (verbose)
{
FUtil.adminAction("TotalFreedomMod", "Deactivating superadmin " + admin.getName() + ", inactive for " + lastLoginHours + " hours.", true);
FUtil.adminAction("TotalFreedomMod", "Deactivating superadmin " + admin.getName() + ", inactive for " + lastLoginHours + " hours", true);
}
admin.setActivated(false);
admin.setActive(false);
Command_logs.deactivateSuperadmin(admin);
}

View File

@ -4,7 +4,10 @@ import com.google.common.collect.Lists;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -61,6 +64,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
{
this.ips.addAll(Arrays.asList(ips));
}
dedupeIps();
this.by = by;
this.expiryUnix = FUtil.getUnixTime(expire);
}
@ -215,12 +219,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
return false;
}
if (hasUsername() && !(getUsername().equalsIgnoreCase(ban.getUsername())))
{
return false;
}
return true;
return !(hasUsername() && !(getUsername().equalsIgnoreCase(ban.getUsername())));
}
@Override
@ -240,12 +239,14 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
this.ips.addAll(cs.getStringList("ips"));
this.by = cs.getString("by", null);
this.reason = cs.getString("reason", null);
this.expiryUnix = cs.getLong("expiry_unix", -1);
this.expiryUnix = cs.getLong("expiry_unix", 0);
dedupeIps();
}
@Override
public void saveTo(ConfigurationSection cs)
{
dedupeIps();
cs.set("username", username);
cs.set("ips", ips.isEmpty() ? null : ips);
cs.set("by", by);
@ -258,4 +259,20 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
{
return username != null || !ips.isEmpty();
}
private void dedupeIps()
{
Set<String> uniqueIps = new HashSet<>();
Iterator<String> it = ips.iterator();
while (it.hasNext())
{
if (!uniqueIps.add(it.next()))
{
it.remove();
}
}
}
}

View File

@ -10,10 +10,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.config.YamlConfig;
import net.pravian.aero.util.Ips;
@ -41,17 +41,6 @@ public class BanManager extends FreedomService
@Override
protected void onStart()
{
load();
}
@Override
protected void onStop()
{
saveAll();
}
public void load()
{
config.load();
@ -79,58 +68,24 @@ public class BanManager extends FreedomService
// Remove expired bans, repopulate ipBans and nameBans,
updateViews();
FLog.info("Loaded " + ipBans.size() + " IP bans and " + nameBans.size() + " username bans");
FLog.info("Loaded " + ipBans.size() + " IP bans and " + nameBans.size() + " username bans.");
// Load unbannable usernames
unbannableUsernames.clear();
unbannableUsernames.addAll((Collection<? extends String>) ConfigEntry.UNBANNABLE_USERNAMES.getList());
unbannableUsernames.addAll((Collection<? extends String>) ConfigEntry.FAMOUS_PLAYERS.getList());
FLog.info("Loaded " + unbannableUsernames.size() + " unbannable usernames.");
}
private void updateViews()
@Override
protected void onStop()
{
// Remove expired bans
for (Iterator<Ban> it = bans.iterator(); it.hasNext();)
{
if (it.next().isExpired())
{
it.remove();
}
}
ipBans.clear();
nameBans.clear();
for (Ban ban : bans)
{
if (ban.hasUsername())
{
nameBans.put(ban.getUsername().toLowerCase(), ban);
}
if (ban.hasIps())
{
for (String ip : ban.getIps())
{
ipBans.put(ip, ban);
}
}
}
saveAll();
logger.info("Saved " + bans.size() + " player bans");
}
public void saveAll()
public Set<Ban> getAllBans()
{
// Remove expired
updateViews();
for (Ban ban : bans)
{
ban.saveTo(config.createSection(String.valueOf(ban.hashCode())));
}
// Save config
config.save();
return Collections.unmodifiableSet(bans);
}
public Collection<Ban> getIpBans()
@ -143,6 +98,21 @@ public class BanManager extends FreedomService
return Collections.unmodifiableCollection(nameBans.values());
}
public void saveAll()
{
// Remove expired
updateViews();
config.clear();
for (Ban ban : bans)
{
ban.saveTo(config.createSection(String.valueOf(ban.hashCode())));
}
// Save config
config.save();
}
public Ban getByIp(String ip)
{
final Ban directBan = ipBans.get(ip);
@ -193,13 +163,12 @@ public class BanManager extends FreedomService
{
final Ban ban = getByIp(ip);
if (ban == null)
if (ban != null)
{
return ban;
bans.remove(ban);
saveAll();
}
bans.remove(ban);
saveAll();
return ban;
}
@ -207,13 +176,12 @@ public class BanManager extends FreedomService
{
final Ban ban = getByUsername(username);
if (ban == null)
if (ban != null)
{
return ban;
bans.remove(ban);
saveAll();
}
bans.remove(ban);
saveAll();
return ban;
}
@ -231,7 +199,7 @@ public class BanManager extends FreedomService
{
if (bans.add(ban))
{
updateViews();
saveAll();
return true;
}
@ -242,23 +210,23 @@ public class BanManager extends FreedomService
{
if (bans.remove(ban))
{
updateViews();
saveAll();
return true;
}
return false;
}
public void purgeIpBans()
public int purge()
{
ipBans.clear();
saveAll();
}
config.clear();
config.save();
public void purgeNameBans()
{
nameBans.clear();
saveAll();
int size = bans.size();
bans.clear();
updateViews();
return size;
}
@EventHandler(priority = EventPriority.LOW)
@ -268,13 +236,13 @@ public class BanManager extends FreedomService
final String ip = Ips.getIp(event);
// Regular ban
Ban ban = plugin.bm.getByUsername(username);
Ban ban = getByUsername(username);
if (ban == null)
{
ban = plugin.bm.getByIp(ip);
ban = getByIp(ip);
}
if (ban != null)
if (ban != null && !ban.isExpired())
{
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ban.bakeKickMessage());
}
@ -302,4 +270,34 @@ public class BanManager extends FreedomService
player.setOp(true);
}
private void updateViews()
{
// Remove expired bans
for (Iterator<Ban> it = bans.iterator(); it.hasNext();)
{
if (it.next().isExpired())
{
it.remove();
}
}
nameBans.clear();
ipBans.clear();
for (Ban ban : bans)
{
if (ban.hasUsername())
{
nameBans.put(ban.getUsername().toLowerCase(), ban);
}
if (ban.hasIps())
{
for (String ip : ban.getIps())
{
ipBans.put(ip, ban);
}
}
}
}
}

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.banning;
import me.totalfreedom.totalfreedommod.util.FLog;
import com.google.common.collect.Sets;
import java.util.Set;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.config.YamlConfig;
import net.pravian.aero.util.Ips;
@ -17,6 +17,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
public class PermbanList extends FreedomService
{
public static final String CONFIG_FILENAME = "permbans.yml";
@Getter
@ -44,7 +45,7 @@ public class PermbanList extends FreedomService
permbannedIps.addAll(config.getStringList(name));
}
FLog.info("Loaded " + permbannedNames.size() + " permanently banned usernames and " + permbannedIps.size() + " permanently banned IPs.");
FLog.info("Loaded " + permbannedIps.size() + " perm IP bans and " + permbannedNames.size() + " perm username bans.");
}
@Override

View File

@ -1,15 +1,16 @@
package me.totalfreedom.totalfreedommod.blocking.command;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import net.pravian.aero.command.CommandReflection;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
@ -22,9 +23,10 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandBlocker extends FreedomService
{
public static Pattern NUMBER_FLAG_PATTERN = Pattern.compile("(:([0-9]){5,})");
private final Pattern flagPattern = Pattern.compile("(:([0-9]){5,})");
//
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
private final List<String> unknownCommands = Lists.newArrayList();
public CommandBlocker(TotalFreedomMod plugin)
{
@ -46,6 +48,7 @@ public class CommandBlocker extends FreedomService
public void load()
{
entryList.clear();
unknownCommands.clear();
final CommandMap commandMap = CommandReflection.getCommandMap();
if (commandMap == null)
@ -89,7 +92,7 @@ public class CommandBlocker extends FreedomService
// Obtain command from alias
if (command == null)
{
FLog.info("Blocking unknown command: /" + commandName);
unknownCommands.add(commandName);
}
else
{
@ -114,7 +117,7 @@ public class CommandBlocker extends FreedomService
}
}
FLog.info("Loaded " + blockedCommands.size() + " blocked commands");
FLog.info("Loaded " + blockedCommands.size() + " blocked commands (" + (blockedCommands.size() - unknownCommands.size()) + " known).");
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -157,7 +160,7 @@ public class CommandBlocker extends FreedomService
for (String part : commandParts)
{
Matcher matcher = NUMBER_FLAG_PATTERN.matcher(part);
Matcher matcher = flagPattern.matcher(part);
if (!matcher.matches())
{
continue;

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.blocking.command;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -43,7 +43,7 @@ public enum CommandBlockerRank
Admin admin = TotalFreedomMod.plugin.al.getAdmin(sender);
if (admin != null)
{
if (admin.getRank() == PlayerRank.SENIOR_ADMIN)
if (admin.getRank() == Rank.SENIOR_ADMIN)
{
return SENIOR;
}

View File

@ -2,13 +2,13 @@ package me.totalfreedom.totalfreedommod.bridge;
import java.util.Iterator;
import java.util.Map;
import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent;
import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent;
import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent;
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -43,7 +43,7 @@ public class BukkitTelnetBridge extends FreedomService
final Admin admin = plugin.al.getEntryByIp(ip, true);
if (admin == null || !admin.isActivated() || !admin.getRank().hasConsole())
if (admin == null || !admin.isActive() || !admin.getRank().hasConsole())
{
return;
}
@ -78,11 +78,11 @@ public class BukkitTelnetBridge extends FreedomService
final Admin admin = plugin.al.getAdmin(player);
if (admin != null)
{
boolean isActivated = admin.isActivated();
boolean active = admin.isActive();
isAdmin = isActivated;
isSeniorAdmin = isActivated && admin.getRank() == PlayerRank.SENIOR_ADMIN;
isTelnetAdmin = isActivated && (isSeniorAdmin || admin.getRank() == PlayerRank.TELNET_ADMIN);
isAdmin = active;
isSeniorAdmin = active && admin.getRank() == Rank.SENIOR_ADMIN;
isTelnetAdmin = active && (isSeniorAdmin || admin.getRank() == Rank.TELNET_ADMIN);
}
playerTags.put("tfm.admin.isAdmin", isAdmin);

View File

@ -3,9 +3,9 @@ package me.totalfreedom.totalfreedommod.bridge;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

View File

@ -4,41 +4,50 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.Bukkit;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class WorldEditBridge extends FreedomService
{
private final WorldEditListener listener;
//
private WorldEditPlugin worldedit = null;
public WorldEditBridge(TotalFreedomMod plugin)
{
super(plugin);
listener = new WorldEditListener(plugin);
}
@Override
protected void onStart()
{
listener.register();
}
@Override
protected void onStop()
{
listener.unregister();
}
private WorldEditPlugin getWorldEditPlugin()
public void undo(Player player, int count)
{
WorldEditPlugin worldEditPlugin = null;
try
{
Plugin we = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
if (we != null)
LocalSession session = getPlayerSession(player);
if (session != null)
{
if (we instanceof WorldEditPlugin)
final BukkitPlayer bukkitPlayer = getBukkitPlayer(player);
if (bukkitPlayer != null)
{
worldEditPlugin = (WorldEditPlugin) we;
for (int i = 0; i < count; i++)
{
session.undo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
}
}
}
}
@ -46,8 +55,47 @@ public class WorldEditBridge extends FreedomService
{
FLog.severe(ex);
}
}
private WorldEditPlugin getWorldEditPlugin()
{
if (worldedit == null)
{
try
{
Plugin we = server.getPluginManager().getPlugin("WorldEdit");
if (we != null)
{
if (we instanceof WorldEditPlugin)
{
worldedit = (WorldEditPlugin) we;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return worldedit;
}
public void setLimit(Player player, int limit)
{
try
{
final LocalSession session = getPlayerSession(player);
if (session != null)
{
session.setBlockChangeLimit(limit);
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return worldEditPlugin;
}
private LocalSession getPlayerSession(Player player)
@ -87,43 +135,4 @@ public class WorldEditBridge extends FreedomService
return null;
}
}
public void undo(Player player, int count)
{
try
{
LocalSession session = getPlayerSession(player);
if (session != null)
{
final BukkitPlayer bukkitPlayer = getBukkitPlayer(player);
if (bukkitPlayer != null)
{
for (int i = 0; i < count; i++)
{
session.undo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
}
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
public void setLimit(Player player, int limit)
{
try
{
final LocalSession session = getPlayerSession(player);
if (session != null)
{
session.setBlockChangeLimit(limit);
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
}

View File

@ -1,9 +1,9 @@
package me.totalfreedom.totalfreedommod.bridge;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.StevenLawson.worldedit.LimitChangedEvent;
import me.StevenLawson.worldedit.SelectionChangedEvent;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.worldedit.LimitChangedEvent;
import me.totalfreedom.worldedit.SelectionChangedEvent;
import net.pravian.aero.component.PluginListener;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

View File

@ -1,10 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
public class CommandFailException extends RuntimeException {
public class CommandFailException extends RuntimeException
{
private static final long serialVersionUID = -92333791173123L;
public CommandFailException(String message) {
public CommandFailException(String message)
{
super(message);
}

View File

@ -33,7 +33,7 @@ public class CommandLoader extends FreedomService
handler.loadFrom(FreedomCommand.class.getPackage());
handler.registerAll("TotalFreedomMod", true);
FLog.info("Loaded " + handler.getExecutors().size() + " commands");
FLog.info("Loaded " + handler.getExecutors().size() + " commands.");
}
@Override

View File

@ -2,13 +2,13 @@ package me.totalfreedom.totalfreedommod.command;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandPermissions
{
PlayerRank level();
Rank level();
SourceType source();

View File

@ -1,14 +1,14 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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...]",

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
public class Command_adminmode extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldTime;
import me.totalfreedom.totalfreedommod.world.WorldWeather;
@ -9,7 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.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 FreedomCommand

View File

@ -0,0 +1,41 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
public class Command_banlist extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length > 0)
{
if (args[0].equalsIgnoreCase("purge"))
{
checkRank(Rank.SUPER_ADMIN);
FUtil.adminAction(sender.getName(), "Purging the ban list", true);
int amount = plugin.bm.purge();
sender.sendMessage(ChatColor.GRAY + "Purged " + amount + " player bans.");
return true;
}
return false;
}
msg(plugin.bm.getAllBans().size() + " player bans ("
+ plugin.bm.getUsernameBans().size() + " usernames, "
+ plugin.bm.getIpBans().size() + " IPs)");
return true;
}
}

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
public class Command_blockcmd extends FreedomCommand
{

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [outermaterial] [innermaterial]>")
public class Command_cage extends FreedomCommand
{

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Random;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "For the people that are still alive.", usage = "/<command>")
public class Command_cake extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.NON_OP, 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 FreedomCommand
{

View File

@ -1,9 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.apache.commons.lang3.ArrayUtils;
@ -16,7 +16,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "No Description Yet", usage = "/<command>")
public class Command_cbtool extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Spy on commands", usage = "/<command>", aliases = "commandspy")
public class Command_cmdspy extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Iterator;
import java.util.Map;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Essentials Interface Command - Color your current nickname.", usage = "/<command> <color>")
public class Command_colorme extends FreedomCommand
{

View File

@ -1,11 +1,11 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>", aliases = "cmdlist")
public class Command_commandlist extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Telnet command - Send a chat message with chat formatting over telnet.", usage = "/<command> <message...>", aliases = "csay")
public class Command_consolesay extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.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 FreedomCommand
{

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Random;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.command.Command;
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Make some noise.", usage = "/<command>")
public class Command_deafen extends FreedomCommand
{

View File

@ -1,14 +1,14 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.lang.reflect.Field;
import me.totalfreedom.totalfreedommod.rank.Rank;
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;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "For developers only - debug things via reflection.", usage = "/<command>")
public class Command_debug extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.OfflinePlayer;
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
public class Command_deop extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
public class Command_deopall extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.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 FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "For the bad Superadmins", usage = "/<command> <playername>")
public class Command_doom extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -8,7 +8,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Enchant items.", usage = "/<command> <list | addall | reset | add <name> | remove <name>>")
public class Command_enchant extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>")
public class Command_ender extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> <carts>", aliases = "ew,rd")
public class Command_entitywipe extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location;
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
public class Command_expel extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Shows all IPs registered to a player", usage = "/<command> <player>")
public class Command_findip extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the flatlands.", usage = "/<command>")
public class Command_flatlands extends FreedomCommand
{

View File

@ -1,14 +1,14 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]", aliases = "fr")
public class Command_freeze extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command>")
public class Command_fuckoff extends FreedomCommand
{

View File

@ -1,18 +1,18 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.UUID;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@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>] ]")

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
public class Command_gcmd extends FreedomCommand
{

View File

@ -1,20 +1,18 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Bans or unbans any player, even those who are not logged in anymore.", usage = "/<command> <purge | <ban | unban> <username>>")
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Bans or unbans any player, even those who are not logged in anymore.", usage = "/<command> <purge | ban <username> [reason] | unban <username>>")
public class Command_glist extends FreedomCommand
{
@ -28,93 +26,90 @@ public class Command_glist extends FreedomCommand
if (args.length == 1)
{
if (args[0].equalsIgnoreCase("purge"))
if ("purge".equals(args[0]))
{
if (getAdmin(sender).getRank() == PlayerRank.SENIOR_ADMIN)
{
plugin.pl.purgeAllData();
msg("Purged playerbase.");
}
else
{
msg("Only Senior Admins may purge the userlist.");
}
checkRank(Rank.SENIOR_ADMIN);
plugin.pl.purgeAllData();
msg("Purged playerbase.");
return true;
}
else
{
return false;
}
return false;
}
else if (args.length == 2)
if (args.length < 2)
{
String username;
final List<String> ips = new ArrayList<>();
return false;
}
final Player player = getPlayer(args[1]);
String username;
final List<String> ips = new ArrayList<>();
if (player == null)
final Player player = getPlayer(args[1]);
if (player == null)
{
final PlayerData entry = plugin.pl.getData(args[1]);
if (entry == null)
{
final PlayerData entry = plugin.pl.getData(args[1]);
if (entry == null)
{
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
return true;
}
username = entry.getUsername();
ips.addAll(entry.getIps());
}
else
{
username = player.getName();
final PlayerData entry = plugin.pl.getData(player);
ips.addAll(entry.getIps());
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
return true;
}
String mode = args[0].toLowerCase();
if (mode.equalsIgnoreCase("ban"))
{
FUtil.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
username = entry.getUsername();
ips.addAll(entry.getIps());
}
else
{
final PlayerData entry = plugin.pl.getData(player);
username = player.getName();
ips.addAll(entry.getIps());
}
final Player target = Bukkit.getPlayer(username);
if (target != null)
{
target.kickPlayer("You have been banned by " + sender.getName() + "\n If you think you have been banned wrongly, appeal here: " + ConfigEntry.SERVER_BAN_URL.getString());
}
if ("ban".equals(args[0]))
{
FUtil.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
Ban ban = Ban.forPlayerFuzzy(player, sender, null, null);
for (String ip : ips)
{
ban.addIp(ip);
ban.addIp(FUtil.getFuzzyIp(ip));
}
plugin.bm.addBan(ban);
}
else if (mode.equalsIgnoreCase("unban"))
final String reason = args.length > 2 ? StringUtils.join(args, " ", 2, args.length) : null;
Ban ban = Ban.forPlayerName(player, sender, null, reason);
for (String ip : ips)
{
FUtil.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
plugin.bm.removeBan(plugin.bm.getByUsername(username));
for (String ip : ips)
{
Ban ban = plugin.bm.getByIp(ip);
if (ban != null)
{
plugin.bm.removeBan(ban);
}
}
ban.addIp(ip);
ban.addIp(FUtil.getFuzzyIp(ip));
}
else
plugin.bm.addBan(ban);
if (player != null)
{
return false;
player.kickPlayer(ban.bakeKickMessage());
}
return true;
}
if ("unban".equals(args[0]))
{
FUtil.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
plugin.bm.removeBan(plugin.bm.getByUsername(username));
for (String ip : ips)
{
Ban ban = plugin.bm.getByIp(ip);
if (ban != null)
{
plugin.bm.removeBan(ban);
}
ban = plugin.bm.getByIp(FUtil.getFuzzyIp(ip));
if (ban != null)
{
plugin.bm.removeBan(ban);
}
}
return true;
}
else
{
return false;
}
return false;
}
}

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.ArrayUtils;
@ -13,7 +13,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Makes someone GTFO (deop and ip ban by username).", usage = "/<command> <partialname>")
public class Command_gtfo extends FreedomCommand
{

View File

@ -1,10 +1,10 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.text.DecimalFormat;
import java.util.concurrent.atomic.AtomicInteger;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.apache.commons.lang.math.DoubleRange;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "View ticks-per-second", usage = "/<command>")
public class Command_health extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
public class Command_invis extends FreedomCommand
{

View File

@ -1,14 +1,14 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Kick all non-superadmins on server.", usage = "/<command>")
public class Command_kicknoob extends FreedomCommand
{

View File

@ -1,9 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.Iterator;
import me.totalfreedom.totalfreedommod.fun.Landminer.Landmine;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.fun.Landminer.Landmine;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -12,7 +12,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Set a landmine trap.", usage = "/<command>")
public class Command_landmine extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Show the last command that someone used.", usage = "/<command> <player>")
public class Command_lastcmd extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i]", aliases = "who")
public class Command_list extends FreedomCommand
{
@ -83,11 +83,11 @@ public class Command_list extends FreedomCommand
continue;
}
names.add(plugin.rm.getRank(player).getColoredTag() + player.getName());
names.add(plugin.rm.getDisplay(player).getColoredTag() + 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)

View File

@ -1,11 +1,11 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.NON_OP, 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 FreedomCommand
{

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandPermissions(level = Rank.SENIOR_ADMIN, 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 FreedomCommand
{

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
@ -10,10 +9,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -21,7 +21,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
public class Command_logs extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.GameRuleHandler;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Control mob rezzing parameters.", usage = "/<command> <on|off|setmax <count>|dragon|giant|ghast|slime>")
public class Command_moblimiter extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
@ -13,7 +13,7 @@ import org.bukkit.entity.Ghast;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>", aliases = "mp")
public class Command_mobpurge extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.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 FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the nether.", usage = "/<command>")
public class Command_nether extends FreedomCommand
{

View File

@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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 FreedomCommand
{

View File

@ -1,11 +1,11 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -13,7 +13,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.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>",
aliases = "nf")

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Essentials Interface Command - Nyanify your nickname.", usage = "/<command> <<nick> | off>")
public class Command_nicknyan extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Switch server online-mode on and off.", usage = "/<command> <on | off>")
public class Command_onlinemode extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
@ -9,7 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
public class Command_op extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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 FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Automatically ops user.", usage = "/<command>")
public class Command_opme extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
public class Command_ops extends FreedomCommand
{

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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 FreedomCommand

View File

@ -4,7 +4,7 @@ import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.config.MainConfig;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
@ -13,7 +13,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.IMPOSTOR, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
public class Command_overlord extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Manage permanently banned players and IPs.", usage = "/<command> reload")
public class Command_permban extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Manage plugins", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
public class Command_plugincontrol extends FreedomCommand
{

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.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]>")

View File

@ -1,10 +1,10 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Validates if a given account is premium.", usage = "/<command> <player>", aliases = "prem")
public class Command_premium extends FreedomCommand
{

View File

@ -1,14 +1,14 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.ProtectArea;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, 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>>")

View File

@ -1,14 +1,14 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Superadmin command - Purge everything! (except for bans).", usage = "/<command>")
public class Command_purgeall extends FreedomCommand
{

View File

@ -1,15 +1,15 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Quick De-Op - deop someone based on a partial name.", usage = "/<command> <partialname>")
public class Command_qdeop extends FreedomCommand
{

View File

@ -1,15 +1,15 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
public class Command_qop extends FreedomCommand
{

View File

@ -1,17 +1,17 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Shows nearby people sorted by distance.", usage = "/<command> [range]")
public class Command_radar extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows your rank.", usage = "/<command>")
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows ranks", usage = "/<command> [player]")
public class Command_rank extends FreedomCommand
{
@ -18,7 +18,7 @@ public class Command_rank extends FreedomCommand
{
for (Player player : server.getOnlinePlayers())
{
msg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage());
msg(player.getName() + " is " + plugin.rm.getDisplay(player).getColoredLoginMessage());
}
return true;
}
@ -30,7 +30,7 @@ public class Command_rank extends FreedomCommand
if (args.length == 0)
{
msg(sender.getName() + " is " + plugin.rm.getDisplayRank(playerSender).getColoredLoginMessage(), ChatColor.AQUA);
msg(sender.getName() + " is " + plugin.rm.getDisplay(sender).getColoredLoginMessage(), ChatColor.AQUA);
return true;
}
@ -42,7 +42,7 @@ public class Command_rank extends FreedomCommand
return true;
}
msg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage(), ChatColor.AQUA);
msg(player.getName() + " is " + plugin.rm.getDisplay(player).getColoredLoginMessage(), ChatColor.AQUA);
return true;
}

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
public class Command_rawsay extends FreedomCommand
{

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@ -9,7 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
@CommandParameters(description = "Report a player for admins to see.", usage = "/<command> <player> <reason>")
public class Command_report extends FreedomCommand
{

View File

@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
@ -13,7 +13,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = false)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = false)
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
public class Command_ro extends FreedomCommand
{

View File

@ -1,12 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[partialname] | undo [partialname] purge [partialname] | purgeall>", aliases = "rb")
public class Command_rollback extends FreedomCommand
{

View File

@ -1,10 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.Date;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.StringUtils;
@ -13,7 +12,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage admins.", usage = "/<command> <list | clean | clearme [ip] | <add | remove | info> <username>>")
public class Command_saconfig extends FreedomCommand
{
@ -41,7 +40,7 @@ public class Command_saconfig extends FreedomCommand
FUtil.adminAction(sender.getName(), "Cleaning admin list", true);
plugin.al.deactivateOldEntries(true);
msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.YELLOW);
msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
@ -49,7 +48,7 @@ public class Command_saconfig extends FreedomCommand
case "clearme":
{
checkPlayer();
checkRank(PlayerRank.SUPER_ADMIN);
checkRank(Rank.SUPER_ADMIN);
final Admin admin = plugin.al.getAdmin(playerSender);
@ -107,7 +106,7 @@ public class Command_saconfig extends FreedomCommand
return false;
}
checkRank(PlayerRank.SUPER_ADMIN);
checkRank(Rank.SUPER_ADMIN);
Admin admin = plugin.al.getEntryByName(args[1]);
@ -140,7 +139,7 @@ public class Command_saconfig extends FreedomCommand
}
checkConsole();
checkRank(PlayerRank.TELNET_ADMIN);
checkRank(Rank.TELNET_ADMIN);
final Player player = getPlayer(args[1]);
@ -162,7 +161,7 @@ public class Command_saconfig extends FreedomCommand
admin.loadFrom(player); // Reset IP, username
}
admin.setActivated(true);
admin.setActive(true);
admin.setLastLogin(new Date());
plugin.al.save(admin);
plugin.al.updateTables();
@ -181,7 +180,8 @@ public class Command_saconfig extends FreedomCommand
}
if (player != null) {
if (player != null)
{
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getFreezeData().isFrozen())
{
@ -201,7 +201,7 @@ public class Command_saconfig extends FreedomCommand
}
checkConsole();
checkRank(PlayerRank.TELNET_ADMIN);
checkRank(Rank.TELNET_ADMIN);
Player player = getPlayer(args[1]);
Admin admin = player == null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Broadcasts the given message as the console, includes sender name.", usage = "/<command> <message>")
public class Command_say extends FreedomCommand
{

View File

@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.ServiceChecker.ServiceStatus;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.NON_OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows the status of all Mojang services", usage = "/<command>")
public class Command_services extends FreedomCommand
{

Some files were not shown because too many files have changed in this diff Show More