From 6edb6be7d96fb7848665406c3f4930edda703394 Mon Sep 17 00:00:00 2001 From: Jerom van der Sar Date: Sun, 6 Mar 2016 16:56:15 +0100 Subject: [PATCH] Many changes for TFM 5.0 Improved admin system Improved Rank system Implemented config converter Improved command handling Updated Aero --- CONTRIBUTING.md | 96 +--------- LICENSE.md | 55 +++++- pom.xml | 42 ++--- .../totalfreedommod/Announcer.java | 2 +- .../totalfreedommod/ConfigConverter.java | 168 ++++++++++++++++++ .../totalfreedommod/FrontDoor.java | 11 +- .../totalfreedommod/GameRuleHandler.java | 2 +- .../totalfreedommod/LoginProcess.java | 1 + .../totalfreedommod/ProtectArea.java | 1 + .../totalfreedommod/ServerInterface.java | 14 +- .../totalfreedommod/ServiceChecker.java | 5 +- .../totalfreedommod/TotalFreedomMod.java | 64 ++++--- .../totalfreedommod/admin/Admin.java | 21 ++- .../totalfreedommod/admin/AdminList.java | 88 +-------- .../totalfreedommod/banning/Ban.java | 31 +++- .../totalfreedommod/banning/BanManager.java | 150 ++++++++-------- .../totalfreedommod/banning/PermbanList.java | 5 +- .../blocking/command/CommandBlocker.java | 13 +- .../blocking/command/CommandBlockerRank.java | 6 +- .../bridge/BukkitTelnetBridge.java | 20 +-- .../bridge/EssentialsBridge.java | 2 +- .../bridge/WorldEditBridge.java | 107 ++++++----- .../bridge/WorldEditListener.java | 6 +- .../command/CommandFailException.java | 8 +- .../command/CommandLoader.java | 2 +- .../command/CommandPermissions.java | 4 +- .../command/Command_adminchat.java | 4 +- .../command/Command_adminmode.java | 4 +- .../command/Command_adminworld.java | 4 +- .../command/Command_banlist.java | 41 +++++ .../command/Command_blockcmd.java | 4 +- .../totalfreedommod/command/Command_cage.java | 4 +- .../totalfreedommod/command/Command_cake.java | 4 +- .../command/Command_cartsit.java | 4 +- .../command/Command_cbtool.java | 4 +- .../command/Command_cmdspy.java | 4 +- .../command/Command_colorme.java | 4 +- .../command/Command_commandlist.java | 4 +- .../command/Command_consolesay.java | 4 +- .../command/Command_creative.java | 4 +- .../command/Command_deafen.java | 4 +- .../command/Command_debug.java | 4 +- .../command/Command_denick.java | 4 +- .../totalfreedommod/command/Command_deop.java | 4 +- .../command/Command_deopall.java | 4 +- .../command/Command_dispfill.java | 4 +- .../totalfreedommod/command/Command_doom.java | 4 +- .../command/Command_enchant.java | 4 +- .../command/Command_ender.java | 4 +- .../command/Command_entitywipe.java | 4 +- .../command/Command_expel.java | 4 +- .../command/Command_findip.java | 4 +- .../command/Command_flatlands.java | 4 +- .../command/Command_freeze.java | 6 +- .../command/Command_fuckoff.java | 4 +- .../command/Command_gadmin.java | 4 +- .../totalfreedommod/command/Command_gcmd.java | 4 +- .../command/Command_glist.java | 143 +++++++-------- .../totalfreedommod/command/Command_gtfo.java | 4 +- .../command/Command_health.java | 6 +- .../command/Command_invis.java | 4 +- .../command/Command_jumppads.java | 4 +- .../command/Command_kicknoob.java | 4 +- .../command/Command_landmine.java | 6 +- .../command/Command_lastcmd.java | 4 +- .../totalfreedommod/command/Command_list.java | 8 +- .../command/Command_localspawn.java | 4 +- .../command/Command_lockup.java | 4 +- .../totalfreedommod/command/Command_logs.java | 10 +- .../command/Command_moblimiter.java | 6 +- .../command/Command_mobpurge.java | 4 +- .../totalfreedommod/command/Command_mp44.java | 4 +- .../command/Command_nether.java | 4 +- .../command/Command_nickclean.java | 4 +- .../command/Command_nickfilter.java | 4 +- .../command/Command_nicknyan.java | 4 +- .../command/Command_onlinemode.java | 4 +- .../totalfreedommod/command/Command_op.java | 4 +- .../command/Command_opall.java | 4 +- .../totalfreedommod/command/Command_opme.java | 4 +- .../totalfreedommod/command/Command_ops.java | 4 +- .../command/Command_orbit.java | 4 +- .../command/Command_overlord.java | 4 +- .../command/Command_permban.java | 4 +- .../command/Command_plugincontrol.java | 4 +- .../command/Command_potion.java | 4 +- .../command/Command_premium.java | 4 +- .../command/Command_protectarea.java | 6 +- .../command/Command_purgeall.java | 4 +- .../command/Command_qdeop.java | 4 +- .../totalfreedommod/command/Command_qop.java | 4 +- .../command/Command_radar.java | 4 +- .../totalfreedommod/command/Command_rank.java | 12 +- .../command/Command_rawsay.java | 4 +- .../command/Command_report.java | 4 +- .../totalfreedommod/command/Command_ro.java | 4 +- .../command/Command_rollback.java | 4 +- .../command/Command_saconfig.java | 20 +-- .../totalfreedommod/command/Command_say.java | 4 +- .../command/Command_services.java | 4 +- .../totalfreedommod/command/Command_setl.java | 4 +- .../command/Command_setlevel.java | 4 +- .../command/Command_setlever.java | 4 +- .../command/Command_setspawnworld.java | 4 +- .../command/Command_smite.java | 4 +- .../command/Command_status.java | 4 +- .../totalfreedommod/command/Command_stfu.java | 4 +- .../totalfreedommod/command/Command_stop.java | 4 +- .../command/Command_survival.java | 4 +- .../totalfreedommod/command/Command_tag.java | 4 +- .../command/Command_tagnyan.java | 4 +- .../totalfreedommod/command/Command_tban.java | 4 +- .../command/Command_tempban.java | 4 +- .../command/Command_tfbanlist.java | 49 ----- .../command/Command_tfipbanlist.java | 50 ------ .../totalfreedommod/command/Command_tfm.java | 6 +- .../command/Command_tfupdate.java | 4 +- .../command/Command_toggle.java | 7 +- .../command/Command_tossmob.java | 4 +- .../command/Command_trail.java | 6 +- .../totalfreedommod/command/Command_warn.java | 4 +- .../command/Command_whitelist.java | 4 +- .../command/Command_whohas.java | 4 +- .../command/Command_wildcard.java | 4 +- .../command/Command_wipeflatlands.java | 4 +- .../command/Command_wipeuserdata.java | 4 +- .../command/FreedomCommand.java | 28 +-- .../command/FreedomCommandExecutor.java | 8 +- .../totalfreedommod/config/ConfigEntry.java | 2 +- .../totalfreedommod/config/MainConfig.java | 2 +- .../totalfreedommod/httpd/HTTPDaemon.java | 14 +- .../httpd/module/Module_dump.java | 4 +- .../httpd/module/Module_help.java | 8 +- .../httpd/module/Module_list.java | 2 +- .../httpd/module/Module_players.java | 4 +- .../httpd/module/Module_schematic.java | 10 +- .../totalfreedommod/player/FPlayer.java | 4 +- .../totalfreedommod/player/PlayerList.java | 2 +- .../totalfreedommod/rank/CustomLoginRank.java | 19 -- .../totalfreedommod/rank/PlayerRank.java | 162 ----------------- .../totalfreedommod/rank/Rank.java | 157 +++++++++++++++- .../totalfreedommod/rank/RankBase.java | 24 +++ .../totalfreedommod/rank/RankManager.java | 58 +++--- .../totalfreedommod/rank/RankProxy.java | 65 ------- .../rank/{TitleRank.java => Title.java} | 6 +- .../totalfreedommod/util/FUtil.java | 5 +- .../totalfreedommod/world/CustomWorld.java | 2 +- src/main/resources/admins.yml | 4 - src/main/resources/bans.yml | 3 +- src/main/resources/config.yml | 4 +- src/main/resources/permbans.yml | 2 +- src/main/resources/plugin.yml | 4 +- src/main/resources/version.yml | 4 + 153 files changed, 1105 insertions(+), 1144 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/ConfigConverter.java create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfbanlist.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfipbanlist.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/rank/CustomLoginRank.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/rank/PlayerRank.java create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/rank/RankBase.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/rank/RankProxy.java rename src/main/java/me/totalfreedom/totalfreedommod/rank/{TitleRank.java => Title.java} (90%) create mode 100644 src/main/resources/version.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d4f7c42..29cd3a48 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 `. 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). \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index 5940335d..99a177f4 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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. diff --git a/pom.xml b/pom.xml index e41d3268..534d53a3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 me.totalfreedom - TotalFreedomModMaven + totalfreedom 5.0 jar @@ -30,7 +30,7 @@ - Total Freedom MC + Total Freedom https://totalfreedom.me @@ -77,7 +77,7 @@ bukkittelnet 4.2 system - ${project.basedir}/lib/BukkitTelnet-4.2.jar + ${project.basedir}/lib/BukkitTelnet-4.3.jar @@ -85,7 +85,7 @@ tf-worldedit 6.1.0-TF system - ${project.basedir}/lib/TF-WorldEdit-6.1.0.jar + ${project.basedir}/lib/TF-WorldEdit-6.1.1.jar @@ -93,7 +93,7 @@ tf-essentials 2.0-TF system - ${project.basedir}/lib/TF-Essentials-2.0.jar + ${project.basedir}/lib/TF-Essentials-2.1.jar @@ -108,6 +108,19 @@ + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + TotalFreedomMod.jar + 1.7 + 1.7 + 1.7 + + + maven-antrun-plugin @@ -116,11 +129,11 @@ initialize - + - + run @@ -170,19 +183,6 @@ - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - TotalFreedomMod.jar - 1.7 - 1.7 - 1.7 - - - com.lukegb.mojo @@ -255,4 +255,4 @@ - \ No newline at end of file + diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java b/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java index 5f88a0dc..47b27586 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java @@ -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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ConfigConverter.java b/src/main/java/me/totalfreedom/totalfreedommod/ConfigConverter.java new file mode 100644 index 00000000..2693914f --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/ConfigConverter.java @@ -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 +{ + + 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 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 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!"); + } + + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java index d7d239e3..3174fc94 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java @@ -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() diff --git a/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java b/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java index 3ded2ab0..3d6eba38 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java @@ -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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index 58445968..7b5c5ec4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java index 75f152fb..eff42e74 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java @@ -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; // diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java index 83e584ef..65715565 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java @@ -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(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java b/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java index 8725cd8a..ddbc448a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java @@ -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 diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 8de31b9b..9ad10181 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -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 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 bridges.start(); timer.update(); - FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms"); // Metrics @ http://mcstats.org/plugin/TotalFreedomMod diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java index dbcb4b0b..5bff70d3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java @@ -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 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) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index ef897602..6f559106 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -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); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java index a6a419f4..987be4f1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java @@ -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 uniqueIps = new HashSet<>(); + + Iterator it = ips.iterator(); + while (it.hasNext()) + { + if (!uniqueIps.add(it.next())) + { + it.remove(); + } + } + + } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java index 323d782e..fb0dd043 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java @@ -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) ConfigEntry.UNBANNABLE_USERNAMES.getList()); + unbannableUsernames.addAll((Collection) ConfigEntry.FAMOUS_PLAYERS.getList()); FLog.info("Loaded " + unbannableUsernames.size() + " unbannable usernames."); - } - private void updateViews() + @Override + protected void onStop() { - - // Remove expired bans - for (Iterator 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 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 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 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); + } + } + } + } + } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java index a9ae8f90..8e1d22ec 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java @@ -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 diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java index 79bd24e3..b64a2e5a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java @@ -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 entryList = Maps.newHashMap(); + private final List 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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java index 44cac55d..14c71a1c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java @@ -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; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java index 08ec7cb7..b8a7dad3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java @@ -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); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java index 40b41bc5..a3859c05 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java @@ -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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java index 7e6f8955..618ac4a7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java @@ -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); - } - } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java index 237a00c7..ed6548a6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java @@ -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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java index 01fead47..64025aea 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java @@ -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); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java index 10346ec9..297f1ef7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java @@ -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 diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java index dcde1a7e..c587593e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java @@ -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(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java index 7c468916..b1670338 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java @@ -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 itself will toggle AdminChat on and off for all messages.", usage = "/ [message...]", diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java index 28f79d02..173e7f19 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java @@ -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 = "/ [on | off]") public class Command_adminmode extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java index e44a8a67..f25b402f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java @@ -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 = "/ [guest < list | purge | add | remove > | time | weather ]") public class Command_adminworld extends FreedomCommand diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java new file mode 100644 index 00000000..cb2ae1b2 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java @@ -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 = "/ [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; + } +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java index dbd5b6e9..0c7ad8af 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java @@ -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 = "/ >", aliases = "blockcommands,blockcommand") public class Command_blockcmd extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java index cf007ad9..3c2d466d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java @@ -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 = "/ [outermaterial] [innermaterial]>") public class Command_cage extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java index 46a70538..0178ce10 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java @@ -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 = "/") public class Command_cake extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java index 20896fcb..b9e0a07d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java @@ -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 = "/ [partialname]") public class Command_cartsit extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java index 09a3a042..2c809112 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java @@ -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 = "/") public class Command_cbtool extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java index b55e7816..c316a46a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java @@ -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 = "/", aliases = "commandspy") public class Command_cmdspy extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java index 08bf53a7..b6734dcf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java @@ -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 = "/ ") public class Command_colorme extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java index 1a0170b9..21176b4b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java @@ -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 = "/", aliases = "cmdlist") public class Command_commandlist extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java index 6976748d..e692cac8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java @@ -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 = "/ ", aliases = "csay") public class Command_consolesay extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java index 504693c9..5b97de08 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java @@ -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 = "/ [partialname]", aliases = "gmc") public class Command_creative extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java index a0429efd..622145ae 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java @@ -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 = "/") public class Command_deafen extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java index 5a3cc6b0..83467786 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java @@ -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 = "/") public class Command_debug extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java index dcd87cf4..697a9388 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java @@ -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 = "/") public class Command_denick extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java index 2f0312b4..0a2d9248 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java @@ -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 = "/ ") public class Command_deop extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java index 12f89b7a..1eb990cf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java @@ -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 = "/") public class Command_deopall extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java index 4537f2a0..8d0e12e3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java @@ -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 = "/ ") public class Command_dispfill extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java index cc4e1bcb..18171a4e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java @@ -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 = "/ ") public class Command_doom extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java index 378a6e51..b1d515e0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java @@ -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 = "/ | remove >") public class Command_enchant extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java index 95857ff3..c982320e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java @@ -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 = "/") public class Command_ender extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java index abcd0773..6a8e7f46 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java @@ -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 = "/ ", aliases = "ew,rd") public class Command_entitywipe extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java index 36405395..0285ff05 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java @@ -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 = "/ [radius] [strength]") public class Command_expel extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java index 60435e1a..6c209106 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java @@ -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 = "/ ") public class Command_findip extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java index 8ae5f61d..ac3fb5c6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java @@ -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 = "/") public class Command_flatlands extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java index 57e062ec..64af6bdd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java @@ -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 = "/ [target | purge]", aliases = "fr") public class Command_freeze extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java index ee7d4979..cdaf96a0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java @@ -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 = "/") public class Command_fuckoff extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java index 16eb92f4..07debd6e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java @@ -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 = "/ [list | [ ] ]") diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java index 6e926bae..d4c179de 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java @@ -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 = "/ ") public class Command_gcmd extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java index 21688baa..c5321006 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java @@ -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 = "/ >") +@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 = "/ [reason] | unban >") 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 ips = new ArrayList<>(); + return false; + } - final Player player = getPlayer(args[1]); + String username; + final List 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; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java index d7f1e2d1..80a832dd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java @@ -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 = "/ ") public class Command_gtfo extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java index ccf45637..7e2713bf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java @@ -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 = "/") public class Command_health extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java index fd0b6902..8fb8bb4b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java @@ -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 = "/ (smite)") public class Command_invis extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java index 669c11bd..1fa32024 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java @@ -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 = "/ | strength >", aliases = "launchpads,jp") public class Command_jumppads extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java index 6e4effca..382a5af7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java @@ -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 = "/") public class Command_kicknoob extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java index 7f8e089e..4ef0ef2f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java @@ -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 = "/") public class Command_landmine extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java index bb43a374..f8d26a55 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java @@ -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 = "/ ") public class Command_lastcmd extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java index 2e30c982..c95798f7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -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 = "/ [-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) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java index 7477c3c8..aa602eb8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java @@ -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 = "/", aliases = "worldspawn,gotospawn") public class Command_localspawn extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java index d26b7987..5c13e005 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java @@ -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 = "/ on | off>>") public class Command_lockup extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java index 5d60aae7..433cfba0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java @@ -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 = "/ [off]") public class Command_logs extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java index e6dbd347..2118b089 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java @@ -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 = "/ |dragon|giant|ghast|slime>") public class Command_moblimiter extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java index 44cc8246..39be4fec 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java @@ -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 = "/", aliases = "mp") public class Command_mobpurge extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java index 522d3342..391de192 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java @@ -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 = "/ ") public class Command_mp44 extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java index 607c3f91..5eb00c28 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java @@ -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 = "/") public class Command_nether extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java index 665302a7..ab4d72f0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java @@ -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 = "/", aliases = "nc") public class Command_nickclean extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java index b75b59fe..a85809c1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java @@ -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 = "/ !", aliases = "nf") diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java index ae1e212a..f1f5e8ca 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java @@ -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 = "/ < | off>") public class Command_nicknyan extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java index 2f373c06..df6884e1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java @@ -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 = "/ ") public class Command_onlinemode extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java index 2b51eff0..2b7fba9d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java @@ -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 = "/ ") public class Command_op extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java index c3448187..2a9233a3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java @@ -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 = "/ [-c | -s]") public class Command_opall extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java index bfc26fb8..a125caa2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java @@ -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 = "/") public class Command_opme extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java index 100d44fe..961fc490 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java @@ -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 = "/ ") public class Command_ops extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java index 19e162e2..3b1c9612 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java @@ -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 = "/ [< | stop>]") public class Command_orbit extends FreedomCommand diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java index 9a21c606..3093dda3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java @@ -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 { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java index 9744b08b..7b54b04c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java @@ -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 = "/ reload") public class Command_permban extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java index 6d99004b..f7f40d63 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java @@ -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 = "/ < > | list>", aliases = "plc") public class Command_plugincontrol extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java index f58b8f69..7648851e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java @@ -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 = "/ [target name]>") diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java index 3b9341bf..b63bd99e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java @@ -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 = "/ ", aliases = "prem") public class Command_premium extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java index 8ea31c1e..c59351bf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java @@ -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 = "/ | add