mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-06-11 06:44:58 +00:00
c12e0daebb
For Spigot 1.14.4+ ## General Gameplay ### Additions - Added default Suffocate cooldown: 6.5 seconds - Added kinetic damage tracker to AirSweep - Added self and others push strength options for AirSuction - Added config option for multiple blocks to be changed per EarthTunnel run, allowing for much faster earth tunnels - Added config to ignore ores completely for EarthTunnel (good for mining) - Added AllowSnow config option for IceBlast - Added AvatarStateCooldown config options for IceBlast and IceBullet - Added config option for ice trapping abilities to not place blocks in players head or feet ### Fixes - Fixed preset command not allowing page numbers higher than 1 - Fixed Catapult and MetalClips not respecting /b invincible - Fixed Charged FireBlast radius and cooldown - Fixed Suffocate being usable through walls - Fixed FireBlast ignoring particle radius options - Fixed FireBurst fragmenting (not looking like a single burst) - Fixed AirSweep knockback to be more consistent (lessened friction) - Fixed AirBlast knockback using wrong push options - Fixed EarthSmash using nonexistent AvatarState options - Fixed error when switching worlds with PhaseChange active - Fixed server crash when hitting falling blocks with high-velocity abilities - Fixed server crash when using EarthGrab over the void - Fixed EarthTunnel not using configurable revert time - Fixed EarthPillars persisting when no entities were around ### Changes - Improved pathing for EarthBlast; works more consistently and can be used from ceilings - Improved aiming for EarthBlast and IceBlast - Changed AirSwipe and AirSweep to originate from the player’s main hand - Changed AirBlast knockback calculations; made the push options affect knockback more directly - Changed EarthTunnel to use tempblocks properly - Moved core combo instructions to config ### Removals - Removed being able to use Lightning while using FireJet - Removed jukeboxes being tempblocks - Removed bending.command.import permission from plugin.yml ## API ### Additions - Added GeneralMethods#getMainHandLocation(Player) - Added GeneralMethods#getClosestEntity(Location, double) - Added GeneralMethods#getClosestLivingEntity(Location, double) - Added "large" abilities collision with each other - Added specific timings for hot spots in the code that should help server owners diagnose lag from PK + player move event + physics event + bending manager - Created local folder repo and update pom for local jar files, this is necessary to use the maven shade plugin. - Added check for concrete powder in move earth - Added PlaceholderAPI support (hopefully more to come) + %projectkorra_slot<1-9>% ability on slot <1-9> + %projectkorra_element% element of the player + %projectkorra_elementcolor% color of the player’s element + %projectkorra_elements% elements the player has - Added "bending" WorldGuard flag. + Used for allowing or denying bending in worldguard regions. Will fall back to the old method of the build flag if the custom flag fails to register or isn't set ### Fixes - Fixed calls to CoreAbility#isEnabled() causing NullPointerExceptions when a CoreAbility is not enabled ### Changes - Changed CoreAbility#getAbility(..) Javadocs to state when it returns null - Formatted codebase - Changed GeneralMethods#getEntitiesAroundPoint() use spigot method for entities around point, should be more optimized - Optimizations to water and air spout to not continually set flying - Optimized revertchecker to not use block.getChunk; this will load the chunk on the server and instead use hashmap of coords - Optimized revertchecker to use paperlib to allow servers running paperspigot to load the chunk for a revert block async - Optimized tempblock revert to load chunk async before updating stateOptimize move event to ignore head movements without directional movement - Optimized physics event to check for air prior to checking for tempblocks - Optimized tempblock set/revert to not apply physics for blocks that don't emit light - Optimize isWater to check for actual water blocks first - Optimize PhaseChange list check, hot spot due to being called in physics event ### Removals - Removed BindChangeEvent; never called or used - Removed HorizontalVelocityTracker that has lasted over 30 seconds, also don't create a tracker for non-living entities
121 lines
5.4 KiB
Java
121 lines
5.4 KiB
Java
package com.projectkorra.projectkorra.command;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.PluginCommand;
|
|
|
|
import com.projectkorra.projectkorra.ProjectKorra;
|
|
|
|
public class Commands {
|
|
|
|
private final ProjectKorra plugin;
|
|
|
|
public static Set<String> invincible = new HashSet<String>();
|
|
public static boolean debugEnabled = false;
|
|
public static boolean isToggledForAll = false;
|
|
|
|
public Commands(final ProjectKorra plugin) {
|
|
this.plugin = plugin;
|
|
debugEnabled = ProjectKorra.plugin.getConfig().getBoolean("debug");
|
|
this.init();
|
|
}
|
|
|
|
// Element Aliases.
|
|
public static String[] airaliases = { "air", "a", "airbending", "airbender" };
|
|
public static String[] chialiases = { "chi", "c", "chiblocking", "chiblocker" };
|
|
public static String[] earthaliases = { "earth", "e", "earthbending", "earthbender" };
|
|
public static String[] firealiases = { "fire", "f", "firebending", "firebender" };
|
|
public static String[] wateraliases = { "water", "w", "waterbending", "waterbender" };
|
|
public static String[] elementaliases = { "air", "a", "airbending", "airbender", "chi", "c", "chiblocking", "chiblocker", "earth", "e", "earthbending", "earthbender", "fire", "f", "firebending", "firebender", "water", "w", "waterbending", "waterbender" };
|
|
public static String[] avataraliases = { "avatar", "av", "avy", "aang", "korra" };
|
|
|
|
// Combo Aliases.
|
|
public static String[] aircomboaliases = { "aircombo", "ac", "aircombos", "airbendingcombos" };
|
|
public static String[] chicomboaliases = { "chicombo", "cc", "chicombos", "chiblockingcombos", "chiblockercombos" };
|
|
public static String[] earthcomboaliases = { "earthcombo", "ec", "earthcombos", "earthbendingcombos" };
|
|
public static String[] firecomboaliases = { "firecombo", "fc", "firecombos", "firebendingcombos" };
|
|
public static String[] watercomboaliases = { "watercombo", "wc", "watercombos", "waterbendingcombos" };
|
|
|
|
public static String[] comboaliases = { "aircombo", "ac", "aircombos", "airbendingcombos", "chicombo", "cc", "chicombos", "chiblockingcombos", "chiblockercombos", "earthcombo", "ec", "earthcombos", "earthbendingcombos", "firecombo", "fc", "firecombos", "firebendingcombos", "watercombo", "wc", "watercombos", "waterbendingcombos" };
|
|
|
|
// Passive Aliases.
|
|
public static String[] passivealiases = { "airpassive", "ap", "airpassives", "airbendingpassives", "chipassive", "cp", "chipassives", "chiblockingpassives", "chiblockerpassives", "earthpassive", "ep", "earthpassives", "earthbendingpassives", "firepassive", "fp", "firepassives", "firebendingpassives", "waterpassive", "wp", "waterpassives", "waterbendingpassives" };
|
|
|
|
// Subelement Aliases.
|
|
public static String[] subelementaliases = { "flight", "fl", "spiritualprojection", "sp", "spiritual", "bloodbending", "bb", "healing", "heal", "icebending", "ice", "ib", "plantbending", "plant", "metalbending", "mb", "metal", "lavabending", "lb", "lava", "sandbending", "sb", "sand", "combustionbending", "combustion", "cb", "lightningbending", "lightning" };
|
|
|
|
// Air.
|
|
public static String[] flightaliases = { "flight", "fl" };
|
|
public static String[] spiritualprojectionaliases = { "spiritualprojection", "sp", "spiritual" };
|
|
|
|
// Water.
|
|
public static String[] bloodaliases = { "bloodbending", "bb" };
|
|
public static String[] healingaliases = { "healing", "heal" };
|
|
public static String[] icealiases = { "icebending", "ice", "ib" };
|
|
public static String[] plantaliases = { "plantbending", "plant" };
|
|
|
|
// Earth.
|
|
public static String[] metalbendingaliases = { "metalbending", "mb", "metal" };
|
|
public static String[] lavabendingaliases = { "lavabending", "lb", "lava" };
|
|
public static String[] sandbendingaliases = { "sandbending", "sb", "sand" };
|
|
|
|
// Fire.
|
|
public static String[] combustionaliases = { "combustionbending", "combustion", "cb" };
|
|
public static String[] lightningaliases = { "lightningbending", "lightning" };
|
|
|
|
// Miscellaneous.
|
|
public static String[] commandaliases = { "b", "pk", "projectkorra", "bending", "mtla", "tla", "korra", "bend" };
|
|
|
|
private void init() {
|
|
final PluginCommand projectkorra = this.plugin.getCommand("projectkorra");
|
|
|
|
/**
|
|
* Set of all of the Classes which extend Command
|
|
*/
|
|
new AddCommand();
|
|
new BindCommand();
|
|
new CheckCommand();
|
|
new ChooseCommand();
|
|
new ClearCommand();
|
|
new CopyCommand();
|
|
new DebugCommand();
|
|
new DisplayCommand();
|
|
new HelpCommand();
|
|
new InvincibleCommand();
|
|
new PermaremoveCommand();
|
|
new PresetCommand();
|
|
new ReloadCommand();
|
|
new RemoveCommand();
|
|
new StatsCommand();
|
|
new ToggleCommand();
|
|
new VersionCommand();
|
|
new WhoCommand();
|
|
|
|
final CommandExecutor exe = (s, c, label, args) -> {
|
|
if (Arrays.asList(commandaliases).contains(label.toLowerCase())) {
|
|
if (args.length > 0) {
|
|
final List<String> sendingArgs = Arrays.asList(args).subList(1, args.length);
|
|
for (final PKCommand command : PKCommand.instances.values()) {
|
|
if (Arrays.asList(command.getAliases()).contains(args[0].toLowerCase())) {
|
|
command.execute(s, sendingArgs);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
PKCommand.instances.get("help").execute(s, new ArrayList<String>());
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
};
|
|
projectkorra.setExecutor(exe);
|
|
projectkorra.setTabCompleter(new BendingTabComplete());
|
|
}
|
|
}
|