Skip to content

Commit

Permalink
2.3 (#39)
Browse files Browse the repository at this point in the history
* Make command a BigDoorsAdapter

* enhance register interaction

* add condition collection to combine condition bag and chain

* Add condition bag to store conditions with less hard coded structure

* add condition registrar for a central condition registration point

* rename used to opened

* add annotation to define meta values of condition

* change condition chain to condition bag

* mark condition type as deprecated

* mark condition scope as deprecated. is replaced by condition annotation

* add additional methods to door condition

* add new custom exceptions

* make evaluator more generic

* Add class to handle condition annotation easier

* move plugin class to core

* fix some nice renaming stuff

* add method to retrieve condition group permission

* add condition registrar, group and container to register conditions

* remove unused annotations

* clean up of condition bag

* add scope enum

* move condition registrar to core

* move condition creation to conditions to be more modular

* do some forbidden stuff

* add a singleton like pattern to register interaction

* some changes related to reformatting

* add argument helper for better validation

* remove unused functions and adjust annotation detection

* minor changes

* add exception for condition registration

* raise eldo utilities to 1.0.14

* moar locale fix

* remove unused array

* rename and clean up base command

* move sub commands to own command classes

* remove unused classes

* group condition collections

* add listener to ensure config consistency

* remove unused methods

* add modification events

* reorganize classes

* add command helper to reduce code duplication

* restrict access

* refactoring

* add Events

* add adapter for commands. not happy with it...

* move listener to condition package

* add documentation

* move to core

* update eldoUtilities to 1.0.16

* small changes

* set default evaluator to AND

* add command to enable and disable a door

* fix for wrong condition types

* remove not required code

* add events to solve not saving config

* add deprecation comment

* add state to info command

* move listener to condition

* reimplement condition creation exception

* add enabled state

* some fixes for wrong tab completion

* raise version to 2.3.0

* remove check which doesnt work because of bukkit...

* change initialization order

* add localization

* minor changes
  • Loading branch information
rainbowdashlabs authored Oct 1, 2020
1 parent c4921cf commit adc35a6
Show file tree
Hide file tree
Showing 85 changed files with 4,885 additions and 3,152 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.eldoria</groupId>
<artifactId>bigdoorsopener</artifactId>
<version>2.2.3</version>
<version>2.3.0</version>
<name>BigDoorsOpener</name>
<url>https://github.com/eldoriarpg/BigDoorOpener</url>
<description>Open and close doors automatically on certain conditions</description>
Expand Down Expand Up @@ -135,7 +135,7 @@
<dependency>
<groupId>de.eldoria</groupId>
<artifactId>EldoUtilities</artifactId>
<version>v1.0.12</version>
<version>v1.0.16</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
70 changes: 70 additions & 0 deletions src/main/java/de/eldoria/bigdoorsopener/commands/BDOCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package de.eldoria.bigdoorsopener.commands;

import com.google.common.cache.Cache;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.About;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.CloneDoor;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.CopyCondition;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.DoorList;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.GiveKey;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.Help;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.Info;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.InvertOpen;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.Reload;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.RemoveCondition;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.SetCondition;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.SetEvaluator;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.SetState;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.StayOpen;
import de.eldoria.bigdoorsopener.commands.bdosubcommands.Unregister;
import de.eldoria.bigdoorsopener.config.Config;
import de.eldoria.bigdoorsopener.core.BigDoorsOpener;
import de.eldoria.bigdoorsopener.core.scheduler.DoorChecker;
import de.eldoria.bigdoorsopener.util.C;
import de.eldoria.eldoutilities.localization.Localizer;
import de.eldoria.eldoutilities.messages.MessageSender;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import nl.pim16aap2.bigDoors.BigDoors;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

import java.util.List;
import java.util.concurrent.TimeUnit;

public class BDOCommand extends de.eldoria.eldoutilities.simplecommands.EldoCommand {
private final Localizer localizer;
private final MessageSender messageSender;

private final Cache<String, List<?>> pluginCache = C.getExpiringCache(30, TimeUnit.SECONDS);

public BDOCommand(BigDoorsOpener plugin, BigDoors doors, Config config, DoorChecker doorChecker) {
this.localizer = BigDoorsOpener.localizer();
messageSender = MessageSender.get(plugin);
BukkitAudiences bukkitAudiences = BukkitAudiences.create(plugin);
Help help = new Help(plugin);
setDefaultCommand(help);
registerCommand("help", help);
registerCommand("about", new About(plugin));
registerCommand("cloneDoor", new CloneDoor(doors, config));
registerCommand("copyCondition", new CopyCondition(doors, config));
registerCommand("giveKey", new GiveKey(doors, config));
registerCommand("info", new Info(doors, plugin, config));
registerCommand("invertOpen", new InvertOpen(doors, config));
registerCommand("list", new DoorList(doors, config));
registerCommand("reload", new Reload(config, doorChecker, plugin));
registerCommand("removeCondition", new RemoveCondition(doors, config));
registerCommand("setCondition", new SetCondition(doors, config));
registerCommand("setEvaluator", new SetEvaluator(doors, config));
registerCommand("stayOpen", new StayOpen(doors, config));
registerCommand("unregister", new Unregister(doors, config));
registerCommand("setState", new SetState(doors, config));
}

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!super.onCommand(sender, command, label, args)) {
messageSender.sendError(sender, localizer.getMessage("error.invalidCommand"));
return true;
}
return true;
}
}
Loading

0 comments on commit adc35a6

Please sign in to comment.