chore: annotation newlines

This commit is contained in:
Sekwah 2024-06-16 05:00:32 +01:00
parent e340a64ea8
commit ddf7406297
42 changed files with 185 additions and 92 deletions

View File

@ -3,6 +3,7 @@ IndentWidth: 4
TabWidth: 4
UseTab: Never
AllowShortFunctionsOnASingleLine: None
BreakAfterJavaFieldAnnotations: true
BreakBeforeBraces: Attach
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakConstructorInitializers: BeforeComma

View File

@ -41,25 +41,33 @@ public class AdvancedPortalsCore {
private static AdvancedPortalsCore instance;
@Inject private CommandRegister commandRegister;
@Inject
private CommandRegister commandRegister;
private CommandWithSubCommands portalCommand;
private CommandWithSubCommands destiCommand;
@Inject private ConfigRepository configRepository;
@Inject
private ConfigRepository configRepository;
@Inject private TagRegistry tagRegistry;
@Inject
private TagRegistry tagRegistry;
@Inject private PortalServices portalServices;
@Inject
private PortalServices portalServices;
@Inject private DestinationServices destinationServices;
@Inject
private DestinationServices destinationServices;
@Inject private PlayerDataServices playerDataRepository;
@Inject
private PlayerDataServices playerDataRepository;
@Inject private GameScheduler gameScheduler;
@Inject
private GameScheduler gameScheduler;
// TEMP REMOVE THIS THIS IS JUST FOR DEV
@Inject private IPlayerDataRepository tempDataRepository;
@Inject
private IPlayerDataRepository tempDataRepository;
public AdvancedPortalsCore(String mcVersion, File dataStorageLoc,
InfoLogger infoLogger,

View File

@ -17,13 +17,17 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.Objects;
public class CoreListeners {
@Inject private PlayerDataServices playerDataServices;
@Inject
private PlayerDataServices playerDataServices;
@Inject private PortalServices portalServices;
@Inject
private PortalServices portalServices;
@Inject private ConfigRepository configRepository;
@Inject
private ConfigRepository configRepository;
@Inject private GameScheduler gameScheduler;
@Inject
private GameScheduler gameScheduler;
public void playerJoin(PlayerContainer player) {
this.playerDataServices.setJoinCooldown(player);

View File

@ -17,9 +17,11 @@ import java.util.Arrays;
import java.util.List;
public class CreateDestiSubCommand extends CreateTaggedSubCommand {
@Inject TagRegistry tagRegistry;
@Inject
TagRegistry tagRegistry;
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -9,7 +9,8 @@ import java.util.List;
import java.util.stream.Collectors;
public class ListDestiSubCommand implements SubCommand {
@Inject DestinationServices portalServices;
@Inject
DestinationServices portalServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -10,7 +10,8 @@ import java.util.Collections;
import java.util.List;
public class RemoveDestiSubCommand implements SubCommand {
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -23,17 +23,23 @@ import java.util.Objects;
*/
public class ShowDestiSubCommand
implements SubCommand, SubCommand.SubCommandOnInit {
@Inject PlayerDataServices tempDataServices;
@Inject
PlayerDataServices tempDataServices;
@Inject GameScheduler gameScheduler;
@Inject
GameScheduler gameScheduler;
@Inject AdvancedPortalsCore core;
@Inject
AdvancedPortalsCore core;
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Inject ServerContainer serverContainer;
@Inject
ServerContainer serverContainer;
@Inject ConfigRepository config;
@Inject
ConfigRepository config;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -10,7 +10,8 @@ import java.util.Collections;
import java.util.List;
public class TeleportDestiSubCommand implements SubCommand {
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -21,13 +21,17 @@ import java.util.Arrays;
import java.util.List;
public class CreatePortalSubCommand extends CreateTaggedSubCommand {
@Inject PortalServices portalServices;
@Inject
PortalServices portalServices;
@Inject TagRegistry tagRegistry;
@Inject
TagRegistry tagRegistry;
@Inject InfoLogger infoLogger;
@Inject
InfoLogger infoLogger;
@Inject ConfigRepository config;
@Inject
ConfigRepository config;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -10,7 +10,8 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.List;
public class EndGatewayBlockSubCommand implements SubCommand {
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -10,7 +10,8 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.List;
public class EndPortalBlockSubCommand implements SubCommand {
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -17,8 +17,10 @@ import java.util.Map;
import java.util.stream.Collectors;
public class LangUpdateSubCommand implements SubCommand {
@Inject private AdvancedPortalsCore portalsCore;
@Inject private ConfigRepository configRepository;
@Inject
private AdvancedPortalsCore portalsCore;
@Inject
private ConfigRepository configRepository;
public LangUpdateSubCommand() {
}

View File

@ -9,7 +9,8 @@ import java.util.List;
import java.util.stream.Collectors;
public class ListPortalsSubCommand implements SubCommand {
@Inject PortalServices portalServices;
@Inject
PortalServices portalServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -10,7 +10,8 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.List;
public class PortalBlockSubCommand implements SubCommand {
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -12,13 +12,17 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.List;
public class ReloadPortalSubCommand implements SubCommand {
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Inject PortalServices portalServices;
@Inject
PortalServices portalServices;
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Inject ConfigRepository configRepository;
@Inject
ConfigRepository configRepository;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -9,7 +9,8 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.List;
public class RemovePortalSubCommand implements SubCommand {
@Inject PortalServices portalServices;
@Inject
PortalServices portalServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -11,9 +11,11 @@ import com.sekwah.advancedportals.core.util.Lang;
import java.util.List;
public class SelectorSubCommand implements SubCommand {
@Inject private ConfigRepository configRepo;
@Inject
private ConfigRepository configRepo;
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -29,17 +29,23 @@ public class ShowPortalSubCommand
boolean alternate_show_trigger = true;
@Inject PlayerDataServices playerDataServices;
@Inject
PlayerDataServices playerDataServices;
@Inject GameScheduler gameScheduler;
@Inject
GameScheduler gameScheduler;
@Inject AdvancedPortalsCore core;
@Inject
AdvancedPortalsCore core;
@Inject ServerContainer serverContainer;
@Inject
ServerContainer serverContainer;
@Inject PortalServices portalServices;
@Inject
PortalServices portalServices;
@Inject ConfigRepository config;
@Inject
ConfigRepository config;
final Color POS1_COLOR = new Color(0, 255, 0);
final Color POS2_COLOR = new Color(255, 0, 0);

View File

@ -25,7 +25,8 @@ import java.util.Set;
* @author sekwah41
*/
public class Destination implements TagTarget {
@Inject transient TagRegistry tagRegistry;
@Inject
transient TagRegistry tagRegistry;
private PlayerLocation loc;

View File

@ -19,7 +19,8 @@ import java.util.*;
* @author sekwah41
*/
public class AdvancedPortal implements TagTarget {
@Inject private transient TagRegistry tagRegistry;
@Inject
private transient TagRegistry tagRegistry;
private BlockLocation maxLoc;
@ -27,9 +28,11 @@ public class AdvancedPortal implements TagTarget {
private final HashMap<String, String[]> args = new HashMap<>();
@Inject private transient PlayerDataServices playerDataServices;
@Inject
private transient PlayerDataServices playerDataServices;
@Inject transient ConfigRepository configRepository;
@Inject
transient ConfigRepository configRepository;
public AdvancedPortal() {
this.minLoc = new BlockLocation();

View File

@ -25,7 +25,8 @@ public class SubCommandRegistry {
*/
protected ArrayList<String> subCommands = new ArrayList<>();
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
/**
* @param arg argument needed to activate

View File

@ -12,7 +12,8 @@ import java.util.*;
* @author sekwah41
*/
public class TagRegistry {
@Inject AdvancedPortalsCore portalsCore;
@Inject
AdvancedPortalsCore portalsCore;
private final ArrayList<String> literalTags = new ArrayList<>();
@ -22,7 +23,8 @@ public class TagRegistry {
private final Map<String, Tag.Creation> creationTags = new HashMap<>();
private final Map<String, Tag.TagStatus> statusTags = new HashMap<>();
@Inject private AdvancedPortalsCore pluginCore;
@Inject
private AdvancedPortalsCore pluginCore;
/**
* Portals to trigger when a portal is activated

View File

@ -13,9 +13,11 @@ import java.util.Map;
public class WarpEffectRegistry {
private Map<String, WarpEffect> warpEffects = new HashMap();
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
/**
* Register a new warp effect.

View File

@ -13,7 +13,8 @@ import javax.inject.Singleton;
public class DestinationRepositoryImpl implements IDestinationRepository {
private final String fileLocation = "desti/";
@Inject DataStorage dataStorage;
@Inject
DataStorage dataStorage;
@Override
public boolean save(String name, Destination destination) {

View File

@ -9,7 +9,8 @@ import java.util.List;
public class PlayerDataRepositoryImpl implements IPlayerDataRepository {
private final String fileLocation = "playerData/";
@Inject DataStorage dataStorage;
@Inject
DataStorage dataStorage;
@Override
public boolean save(String name, PlayerData playerData) {

View File

@ -13,7 +13,8 @@ import java.util.*;
public class PortalRepositoryImpl implements IPortalRepository {
private final String fileLocation = "portals/";
@Inject DataStorage dataStorage;
@Inject
DataStorage dataStorage;
/**
* In memory copy of the portal files as they will be accessed every

View File

@ -18,9 +18,11 @@ import org.yaml.snakeyaml.nodes.Tag;
public class DataStorage {
private final File dataFolder;
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
public DataStorage(File dataStorageLoc) {
this.dataFolder = dataStorageLoc;

View File

@ -15,7 +15,8 @@ public class ReflectiveConstructor<T> extends Constructor {
private static final Unsafe unsafe = getUnsafe();
private final Class<T> clazz;
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
public ReflectiveConstructor(Class<T> clazz, LoaderOptions loadingConfig) {
super(clazz, loadingConfig);

View File

@ -17,9 +17,11 @@ import javax.inject.Singleton;
@Singleton
public class DestinationServices {
@Inject private IDestinationRepository destinationRepository;
@Inject
private IDestinationRepository destinationRepository;
@Inject TagRegistry tagRegistry;
@Inject
TagRegistry tagRegistry;
private final Map<String, Destination> destinationCache = new HashMap<>();

View File

@ -19,9 +19,11 @@ public final class PlayerDataServices {
*/
private Map<UUID, PlayerData> tempDataMap = new HashMap<>();
@Inject private IPlayerDataRepository tempDataRepository;
@Inject
private IPlayerDataRepository tempDataRepository;
@Inject private ConfigRepository configRepository;
@Inject
private ConfigRepository configRepository;
public PlayerData getPlayerData(PlayerContainer player) {
return tempDataMap.computeIfAbsent(player.getUUID(), uuid -> {

View File

@ -19,15 +19,19 @@ import javax.inject.Singleton;
@Singleton
public class PortalServices {
@Inject private IPortalRepository portalRepository;
@Inject
private IPortalRepository portalRepository;
@Inject private transient PlayerDataServices playerDataServices;
@Inject
private transient PlayerDataServices playerDataServices;
@Inject private ConfigRepository configRepository;
@Inject
private ConfigRepository configRepository;
private final Map<String, AdvancedPortal> portalCache = new HashMap<>();
@Inject TagRegistry tagRegistry;
@Inject
TagRegistry tagRegistry;
public void loadPortals() {
List<String> portalNames = portalRepository.getAllNames();

View File

@ -18,11 +18,14 @@ import java.util.Random;
import javax.annotation.Nullable;
public class CooldownTag implements Tag.Activation, Tag.Creation {
@Inject transient PlayerDataServices playerDataServices;
@Inject
transient PlayerDataServices playerDataServices;
@Inject transient ConfigRepository configRepository;
@Inject
transient ConfigRepository configRepository;
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
public static String TAG_NAME = "cooldown";

View File

@ -15,9 +15,11 @@ import javax.annotation.Nullable;
public class DestiTag implements Tag.Activation, Tag.AutoComplete, Tag.Split {
public static String TAG_NAME = "destination";
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Inject WarpEffectRegistry warpEffectRegistry;
@Inject
WarpEffectRegistry warpEffectRegistry;
private final TagType[] tagTypes = new TagType[] {TagType.PORTAL};

View File

@ -12,11 +12,14 @@ import javax.annotation.Nullable;
import javax.inject.Inject;
public class PermissionTag implements Tag.Activation {
@Inject transient PlayerDataServices playerDataServices;
@Inject
transient PlayerDataServices playerDataServices;
@Inject transient ConfigRepository configRepository;
@Inject
transient ConfigRepository configRepository;
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
public static String TAG_NAME = "permission";

View File

@ -8,7 +8,8 @@ import java.util.List;
import javax.annotation.Nullable;
public class TriggerBlockTag implements Tag.AutoComplete, Tag.Split {
@Inject private ServerContainer serverContainer;
@Inject
private ServerContainer serverContainer;
public static String TAG_NAME = "triggerblock";

View File

@ -21,9 +21,11 @@ public class Lang {
public static final Lang instance = new Lang();
private final HashMap<String, String> languageMap = new HashMap<>();
@Inject private DataStorage dataStorage;
@Inject
private DataStorage dataStorage;
@Inject private InfoLogger infoLogger;
@Inject
private InfoLogger infoLogger;
public static final String DEFAULT_LANG = "en_GB";

View File

@ -38,7 +38,8 @@ public interface Tag {
String getName();
@Nullable String[] getAliases();
@Nullable
String[] getAliases();
String description();
@ -50,9 +51,11 @@ public interface Tag {
* @param argData
* @return
*/
@Nullable List<String> autoComplete(String argData);
@Nullable
List<String> autoComplete(String argData);
@Nullable String splitString();
@Nullable
String splitString();
}
interface Split extends Tag {
@ -62,7 +65,8 @@ public interface Tag {
*
* @return null if the tag does not support splitting
*/
@Nullable String splitString();
@Nullable
String splitString();
}
/**

View File

@ -25,9 +25,11 @@ public class Listeners implements Listener {
private CoreListeners coreListeners = AdvancedPortalsCore.getInstance().getCoreListeners();
@Inject private PortalServices portalServices;
@Inject
private PortalServices portalServices;
@Inject private ConfigRepository configRepository;
@Inject
private ConfigRepository configRepository;
// Entity and portal events
@EventHandler

View File

@ -17,11 +17,14 @@ import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
public class UpdatePortalSubCommand implements SubCommand {
@Inject PortalServices portalServices;
@Inject
PortalServices portalServices;
@Inject DestinationServices destinationServices;
@Inject
DestinationServices destinationServices;
@Inject PortalServices portalService;
@Inject
PortalServices portalService;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {

View File

@ -16,7 +16,8 @@ import org.bukkit.entity.Entity;
* from a player
*/
public class SpigotEntityContainer implements EntityContainer {
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
private final Entity entity;

View File

@ -22,7 +22,8 @@ import org.bukkit.inventory.meta.ItemMeta;
*/
public class SpigotPlayerContainer
extends SpigotEntityContainer implements PlayerContainer {
@Inject private AdvancedPortalsCore portalsCore;
@Inject
private AdvancedPortalsCore portalsCore;
private final Player player;

View File

@ -4,7 +4,8 @@ import com.sekwah.advancedportals.core.registry.WarpEffectRegistry;
import javax.inject.Inject;
public class SpigotWarpEffects {
@Inject private WarpEffectRegistry warpEffectRegistry;
@Inject
private WarpEffectRegistry warpEffectRegistry;
public void registerEffects() {
warpEffectRegistry.registerEffect("ender", new EnderWarpEffect());