Grammar fixes and update dependencies

This commit is contained in:
Telesphoreo 2023-03-08 13:30:51 -06:00
parent 91fd30495f
commit 4f779eecf6
20 changed files with 108 additions and 68 deletions

View File

@ -1,24 +1,37 @@
For those who are wanting to contribute, we fully encourage doing so. There are a few rules we require following when contributing however. For those who are wanting to contribute, we fully encourage doing so. There are a few rules we require following when
contributing however.
## Steps ## Steps
1. Make an issue and get feedback. It's important to know if your idea will be accepted before writing any code. 1. Make an issue and get feedback. It's important to know if your idea will be accepted before writing any code.
- If it is a feature request, describe the feature and be extremely specific. - If it is a feature request, describe the feature and be extremely specific.
- If it is a bug report, ensure you include how to reproduce the bug and the expected outcome - If it is a bug report, ensure you include how to reproduce the bug and the expected outcome
- If it is an enhancement, describe your proposed changes. Ensure you are extremely specific. - If it is an enhancement, describe your proposed changes. Ensure you are extremely specific.
2. Fork this project 2. Fork this project
3. Create a new branch that describes the new feature, enhancement, or bug fix. For example, this is good: `feature/add-xyz`. This is bad: `fix-this-lol`. 3. Create a new branch that describes the new feature, enhancement, or bug fix. For example, this is
good: `feature/add-xyz`. This is bad: `fix-this-lol`.
4. Write the code that addresses your change. 4. Write the code that addresses your change.
- Keep in mind that it **must** be formatted correctly. If you are using IntelliJ, there is a `codeStyle.xml` file that tells IntelliJ how to format your code. Check this link for information on how to use the file: https://www.jetbrains.com/help/idea/configuring-code-style.html#import-export-schemes
- If you are not using IntelliJ, that is fine. We use the Plexus Code Style (which is almost the same as Allman) so please format your code accordingly. - Keep in mind that it **must** be formatted correctly. If you are using IntelliJ, there is a `codeStyle.xml` file that
tells IntelliJ how to format your code. Check this link for information on how to use the
file: https://www.jetbrains.com/help/idea/configuring-code-style.html#import-export-schemes
- If you are not using IntelliJ, that is fine. We use the Plexus Code Style (which is almost the same as Allman) so
please format your code accordingly.
6. Push your changes to your new branch and make a PR based off of that branch. 6. Push your changes to your new branch and make a PR based off of that branch.
## Requirements for a PR ## Requirements for a PR
- The issue must be marked as approved - The issue must be marked as approved
- It must only address each specific issue. Don't make one PR for multiple issues. - It must only address each specific issue. Don't make one PR for multiple issues.
- Your PR must compile and work. If it does not compile or work, your PR will most likely be rejected. - Your PR must compile and work. If it does not compile or work, your PR will most likely be rejected.
## Code requirements ## Code requirements
- Most importantly, your code must be efficient. Your pull request may be rejected if your code is deemed inefficient or sloppy.
- Most importantly, your code must be efficient. Your pull request may be rejected if your code is deemed inefficient or
sloppy.
- Do not repeat yourself. Create functions as needed if you're using large blocks of code over and over again. - Do not repeat yourself. Create functions as needed if you're using large blocks of code over and over again.
- Do not use an excessive amount of commits when making your PR. It makes the master branch look messy. - Do not use an excessive amount of commits when making your PR. It makes the master branch look messy.
- Your code must be consistent with Plex's codebase. If a function already exists, use it. - Your code must be consistent with Plex's codebase. If a function already exists, use it.

View File

@ -1,4 +1,6 @@
# Module-TFMExtras [![Build Status](https://ci.plex.us.org/job/Module-TFMExtras/badge/icon)](https://ci.plex.us.org/job/Module-TFMExtras/) # Module-TFMExtras [![Build Status](https://ci.plex.us.org/job/Module-TFMExtras/badge/icon)](https://ci.plex.us.org/job/Module-TFMExtras/)
Adds extra commands to Plex which makes it behave more like TotalFreedomMod. Adds extra commands to Plex which makes it behave more like TotalFreedomMod.
**Note:** Please do not use any code licensed under the TotalFreedom General License for this project. It is not allowed. **Note:** Please do not use any code licensed under the TotalFreedom General License for this project. It is not
allowed.

View File

@ -16,16 +16,15 @@ repositories {
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.24") compileOnly("org.projectlombok:lombok:1.18.26")
annotationProcessor("org.projectlombok:lombok:1.18.24") annotationProcessor("org.projectlombok:lombok:1.18.26")
compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
implementation("org.apache.commons:commons-lang3:3.12.0") implementation("org.apache.commons:commons-lang3:3.12.0")
compileOnly("dev.plex:server:1.2-SNAPSHOT") compileOnly("dev.plex:server:1.3-SNAPSHOT")
compileOnly("dev.plex:api:1.2-SNAPSHOT")
} }
group = "dev.plex" group = "dev.plex"
version = "1.2-SNAPSHOT" version = "1.3-SNAPSHOT"
description = "Module-TFMExtras" description = "Module-TFMExtras"
java { java {

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -2,7 +2,7 @@ package dev.plex;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.ClassPath; import com.google.common.reflect.ClassPath;
import dev.plex.command.*; import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.config.ModuleConfig; import dev.plex.config.ModuleConfig;
@ -12,20 +12,17 @@ import dev.plex.listener.PlayerListener;
import dev.plex.listener.PlexListener; import dev.plex.listener.PlexListener;
import dev.plex.module.PlexModule; import dev.plex.module.PlexModule;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.World;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import dev.plex.util.ReflectionsUtil;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.World;
public class TFMExtras extends PlexModule public class TFMExtras extends PlexModule
{ {
@Getter @Getter
@ -49,29 +46,36 @@ public class TFMExtras extends PlexModule
@Override @Override
public void enable() public void enable()
{ {
registerListener(new JumpPadsListener()); registerListener(new JumpPadsListener());
registerListener(new PlayerListener()); registerListener(new PlayerListener());
getClassesFrom("dev.plex.command").forEach(aClass -> { getClassesFrom("dev.plex.command").forEach(aClass ->
{
if (aClass.getSuperclass() == PlexCommand.class && aClass.isAnnotationPresent(CommandParameters.class) && aClass.isAnnotationPresent(CommandPermissions.class)) if (aClass.getSuperclass() == PlexCommand.class && aClass.isAnnotationPresent(CommandParameters.class) && aClass.isAnnotationPresent(CommandPermissions.class))
{ {
try { try
{
PlexCommand plexCommand = (PlexCommand) aClass.getConstructors()[0].newInstance(); PlexCommand plexCommand = (PlexCommand) aClass.getConstructors()[0].newInstance();
registerCommand(plexCommand); registerCommand(plexCommand);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { }
catch (InstantiationException | IllegalAccessException | InvocationTargetException e)
{
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
}); });
getClassesFrom("dev.plex.listener").forEach(aClass -> { getClassesFrom("dev.plex.listener").forEach(aClass ->
{
if (aClass.getSuperclass() == PlexListener.class) if (aClass.getSuperclass() == PlexListener.class)
{ {
try { try
{
PlexListener plexListener = (PlexListener) aClass.getConstructors()[0].newInstance(); PlexListener plexListener = (PlexListener) aClass.getConstructors()[0].newInstance();
registerListener(plexListener); registerListener(plexListener);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { }
catch (InstantiationException | IllegalAccessException | InvocationTargetException e)
{
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -83,7 +87,7 @@ public class TFMExtras extends PlexModule
addDefaultMessage("chatCleared", "<red>{0} - Cleared the chat", "0 - The command sender"); addDefaultMessage("chatCleared", "<red>{0} - Cleared the chat", "0 - The command sender");
addDefaultMessage("attributeList", "<gold>All possible attributes: <yellow>{0}", "0 - The attribute list, each split by a new line"); addDefaultMessage("attributeList", "<gold>All possible attributes: <yellow>{0}", "0 - The attribute list, each split by a new line");
addDefaultMessage("modifiedAutoClear", "<gold>{0} will {1} have their inventory cleared when they join.", "0 - The player who will have their inventory cleared on join", "1 - Whether they had this option toggled (returns: 'no longer', 'now')"); addDefaultMessage("modifiedAutoClear", "<gold>{0} will {1} have their inventory cleared when they join.", "0 - The player who will have their inventory cleared on join", "1 - Whether they had this option toggled (returns: 'no longer', 'now')");
addDefaultMessage("modifiedAutoTeleport", "<gold>{0} will {1} have be teleported automatically when they join.", "0 - The player to be tp'd automatically", "1 - Whether they had this option toggled (returns: 'no longer', 'now')"); addDefaultMessage("modifiedAutoTeleport", "<gold>{0} will {1} be teleported automatically when they join.", "0 - The player to be teleported automatically", "1 - Whether they had this option toggled (returns: 'no longer', 'now')");
} }
@Override @Override
@ -96,26 +100,34 @@ public class TFMExtras extends PlexModule
{ {
double x = ThreadLocalRandom.current().nextDouble(-100000, 100000); double x = ThreadLocalRandom.current().nextDouble(-100000, 100000);
double z = ThreadLocalRandom.current().nextDouble(-100000, 100000); double z = ThreadLocalRandom.current().nextDouble(-100000, 100000);
double y = world.getHighestBlockYAt((int)x, (int)z) + 1; double y = world.getHighestBlockYAt((int) x, (int) z) + 1;
return new Location(world, x, y, z); return new Location(world, x, y, z);
} }
private Set<Class<?>> getClassesFrom(String packageName) { private Set<Class<?>> getClassesFrom(String packageName)
{
Set<Class<?>> classes = new HashSet(); Set<Class<?>> classes = new HashSet();
try { try
{
ClassPath path = ClassPath.from(TFMExtras.class.getClassLoader()); ClassPath path = ClassPath.from(TFMExtras.class.getClassLoader());
ImmutableSet<ClassPath.ClassInfo> infoSet = path.getTopLevelClasses(packageName); ImmutableSet<ClassPath.ClassInfo> infoSet = path.getTopLevelClasses(packageName);
infoSet.forEach((info) -> { infoSet.forEach((info) ->
try { {
try
{
Class<?> clazz = Class.forName(info.getName()); Class<?> clazz = Class.forName(info.getName());
classes.add(clazz); classes.add(clazz);
} catch (ClassNotFoundException var4) { }
catch (ClassNotFoundException var4)
{
PlexLog.error("Unable to find class " + info.getName() + " in " + packageName); PlexLog.error("Unable to find class " + info.getName() + " in " + packageName);
} }
}); });
} catch (IOException var4) { }
catch (IOException var4)
{
PlexLog.error("Something went wrong while fetching classes from " + packageName); PlexLog.error("Something went wrong while fetching classes from " + packageName);
throw new RuntimeException(var4); throw new RuntimeException(var4);
} }

View File

@ -4,7 +4,6 @@ import dev.plex.TFMExtras;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.List;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -12,6 +11,8 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
@CommandParameters(name = "admininfo", description = "Information on how to apply for admin", aliases = "ai,si,staffinfo") @CommandParameters(name = "admininfo", description = "Information on how to apply for admin", aliases = "ai,si,staffinfo")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.admininfo") @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.admininfo")
public class AdminInfoCommand extends PlexCommand public class AdminInfoCommand extends PlexCommand

View File

@ -3,7 +3,6 @@ package dev.plex.command;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.Arrays;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
@ -12,6 +11,8 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
@CommandParameters(name = "attributes", description = "Lists all possible attributes", aliases = "attributelist,attrlist") @CommandParameters(name = "attributes", description = "Lists all possible attributes", aliases = "attributelist,attrlist")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.attrlist") @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.attrlist")
public class AttributeListCommand extends PlexCommand public class AttributeListCommand extends PlexCommand

View File

@ -7,13 +7,14 @@ import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.List;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
@CommandParameters(name = "autoclear", description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/<command> <player>", aliases = "aclear,ac") @CommandParameters(name = "autoclear", description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/<command> <player>", aliases = "aclear,ac")
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.autoclear") @CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.autoclear")
public class AutoClearCommand extends PlexCommand public class AutoClearCommand extends PlexCommand

View File

@ -7,7 +7,6 @@ import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.List;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
@ -15,6 +14,8 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
@CommandParameters(name = "autoteleport", description = "If a player is specified, it will toggle whether or not the player is automatically teleported when they join. If no player is specified, you will be randomly teleported", usage = "/<command> [player]", aliases = "autotp,rtp,randomtp,tpr") @CommandParameters(name = "autoteleport", description = "If a player is specified, it will toggle whether or not the player is automatically teleported when they join. If no player is specified, you will be randomly teleported", usage = "/<command> [player]", aliases = "autotp,rtp,randomtp,tpr")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.autotp") @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.autotp")
public class AutoTeleportCommand extends PlexCommand public class AutoTeleportCommand extends PlexCommand

View File

@ -4,7 +4,6 @@ import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.punishment.Punishment; import dev.plex.punishment.Punishment;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.stream.Collectors;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -12,6 +11,8 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.stream.Collectors;
@CommandParameters(name = "banlist", description = "Manages the banlist", usage = "/<command> [purge]") @CommandParameters(name = "banlist", description = "Manages the banlist", usage = "/<command> [purge]")
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.banlist") @CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.banlist")
public class BanListCommand extends PlexCommand public class BanListCommand extends PlexCommand

View File

@ -4,9 +4,6 @@ import dev.plex.Plex;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -17,6 +14,10 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@CommandParameters(name = "cartsit", description = "Sit in nearest minecart. If target is in a minecart already, they will be ejected", aliases = "minecartsit") @CommandParameters(name = "cartsit", description = "Sit in nearest minecart. If target is in a minecart already, they will be ejected", aliases = "minecartsit")
@CommandPermissions(level = Rank.NONOP, permission = "plex.tfmextras.cartsit") @CommandPermissions(level = Rank.NONOP, permission = "plex.tfmextras.cartsit")
public class CartSitCommand extends PlexCommand public class CartSitCommand extends PlexCommand

View File

@ -4,8 +4,6 @@ import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicInteger;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -16,6 +14,9 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicInteger;
@CommandParameters(name = "cloudclear", description = "Clears lingering potion area effect clouds", aliases = "clearcloud,aeclear") @CommandParameters(name = "cloudclear", description = "Clears lingering potion area effect clouds", aliases = "clearcloud,aeclear")
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.cloudclear") @CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.cloudclear")
public class CloudClearCommand extends PlexCommand public class CloudClearCommand extends PlexCommand

View File

@ -1,6 +1,5 @@
package dev.plex.command; package dev.plex.command;
import dev.plex.TFMExtras;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@ -12,13 +11,13 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
@CommandParameters(name = "eject", description = "Removes all passengers from a player") @CommandParameters(name = "eject", description = "Removes all passengers from a player")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME) @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME)
public class EjectCommand extends PlexCommand { public class EjectCommand extends PlexCommand
{
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{
final int passengers = player.getPassengers().size(); final int passengers = player.getPassengers().size();
player.eject(); player.eject();
return MiniMessage.miniMessage().deserialize("<gray>Ejected " + passengers + " passengers."); return MiniMessage.miniMessage().deserialize("<gray>Ejected " + passengers + " passengers.");

View File

@ -22,9 +22,11 @@ import java.util.List;
@CommandParameters(name = "enchant", description = "Enchants an item", usage = "/<command> <add | reset | list | addall | remove>", aliases = "enchantment") @CommandParameters(name = "enchant", description = "Enchants an item", usage = "/<command> <add | reset | list | addall | remove>", aliases = "enchantment")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.enchant", source = RequiredCommandSource.IN_GAME) @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.enchant", source = RequiredCommandSource.IN_GAME)
public class EnchantCommand extends PlexCommand { public class EnchantCommand extends PlexCommand
{
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{
if (args.length == 0) if (args.length == 0)
{ {
return usage(); return usage();
@ -58,13 +60,15 @@ public class EnchantCommand extends PlexCommand {
return null; return null;
} }
private List<Enchantment> getEnchantments(ItemStack item) { private List<Enchantment> getEnchantments(ItemStack item)
{
List<Enchantment> enchants = Lists.newArrayList(); List<Enchantment> enchants = Lists.newArrayList();
Arrays.stream(Enchantment.values()).filter(enchantment -> enchantment.canEnchantItem(item)).forEach(enchants::add); Arrays.stream(Enchantment.values()).filter(enchantment -> enchantment.canEnchantItem(item)).forEach(enchants::add);
return enchants; return enchants;
} }
private String[] getEnchantmentNames(ItemStack item) { private String[] getEnchantmentNames(ItemStack item)
{
return getEnchantments(item).stream().map(enchantment -> enchantment.key().value()).toArray(String[]::new); return getEnchantments(item).stream().map(enchantment -> enchantment.key().value()).toArray(String[]::new);
} }
} }

View File

@ -8,9 +8,6 @@ import dev.plex.jumppads.JumpPads;
import dev.plex.jumppads.Mode; import dev.plex.jumppads.Mode;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils; import dev.plex.util.PlexUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -20,7 +17,11 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "jumppads", usage = "/jumppads <mode> [player]", description = "Enables jump pads for yourself or another player. Mode types available: none, regular, enhanced, extreme, ultimate", aliases = "jp, pads, launchpads") import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@CommandParameters(name = "jumppads", usage = "/jumppads <mode> [player]", description = "Enables jump pads for yourself or another player. Mode types available: none, regular, enhanced, extreme, ultimate", aliases = "jp,pads,launchpads")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.jumppads", source = RequiredCommandSource.ANY) @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.jumppads", source = RequiredCommandSource.ANY)
public class JumpPadsCommand extends PlexCommand public class JumpPadsCommand extends PlexCommand
{ {

View File

@ -4,9 +4,6 @@ import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
import dev.plex.rank.enums.Rank; import dev.plex.rank.enums.Rank;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -16,6 +13,10 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
@CommandParameters(name = "randomfish", description = "Spawns a random type of fish at your location", aliases = "rfish,bird") @CommandParameters(name = "randomfish", description = "Spawns a random type of fish at your location", aliases = "rfish,bird")
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.randomfish", source = RequiredCommandSource.IN_GAME) @CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.randomfish", source = RequiredCommandSource.IN_GAME)
public class RandomFishCommand extends PlexCommand public class RandomFishCommand extends PlexCommand

View File

@ -1,11 +1,6 @@
package dev.plex.jumppads; package dev.plex.jumppads;
import dev.plex.TFMExtras; import dev.plex.TFMExtras;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Tag; import org.bukkit.Tag;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -13,6 +8,11 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
public class JumpPads public class JumpPads
{ {
public final Map<UUID, Mode> playerModeMap = new HashMap<>(); public final Map<UUID, Mode> playerModeMap = new HashMap<>();

View File

@ -59,7 +59,9 @@ public class JumpPadsListener extends PlexListener
if (jumpPads.wool.getValues().contains(b.getType())) if (jumpPads.wool.getValues().contains(b.getType()))
{ {
if (!(event.getFrom().getY() > block.getY() + 0.1 && ((int) event.getTo().getY() == block.getY()))) if (!(event.getFrom().getY() > block.getY() + 0.1 && ((int) event.getTo().getY() == block.getY())))
{
return; return;
}
if (w.y() == -1) if (w.y() == -1)
{ {
playerVector.add(new Vector(0.0, jumpPads.SCALAR * jumpPads.STRENGTH, 0.0)); playerVector.add(new Vector(0.0, jumpPads.SCALAR * jumpPads.STRENGTH, 0.0));

View File

@ -1,4 +1,4 @@
name: Module-TFMExtras name: Module-TFMExtras
main: dev.plex.TFMExtras main: dev.plex.TFMExtras
description: TFM extras for Plex description: TFM extras for Plex
version: 1.2-SNAPSHOT version: 1.3-SNAPSHOT

View File

@ -1,4 +1,4 @@
# TFM Extras Configuration File # # TFM Extras Configuration File #
server: server:
# The strength of the Jump Pads. Must be a positive whole number. Not recommended being greater than 10. # The strength of the Jump Pads. Must be a positive whole number. Not recommended being greater than 10.