Adds some more code for getting closer to a working plugin

Loads signs from disk when executing the reload command
Adds code for sign registration
Saves signs when adding/removing a sign
Makes sure to initialize the translator
Adds a check for whether a sign is registered
This commit is contained in:
2022-01-13 17:14:29 +01:00
parent a77c297e58
commit 71e932bf40
6 changed files with 63 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import net.knarcraft.permissionsigns.command.PermissionSignsCommand;
import net.knarcraft.permissionsigns.command.PermissionSignsTabCompleter;
import net.knarcraft.permissionsigns.container.PermissionSign;
import net.knarcraft.permissionsigns.container.SignCreationRequest;
import net.knarcraft.permissionsigns.formatting.Translator;
import net.knarcraft.permissionsigns.thread.SignCreationRequestTimeoutThread;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
@ -27,6 +28,7 @@ public final class PermissionSigns extends JavaPlugin {
/**
* Instantiates the permission signs class
*/
@SuppressWarnings("unused")
public PermissionSigns() {
super();
instance = this;
@ -128,8 +130,9 @@ public final class PermissionSigns extends JavaPlugin {
//TODO: Start sign creation when the create command is used and save the data until an empty sign is right-clicked
//TODO: Check for existence of old permission signs when clicked and register them as new permission signs. If
// it has the permissionSigns header and a name matching contents in signdata.yml, add it.
// it has the permissionSigns header and a name matching contents in signs.yml, add it.
Translator.loadLanguages("en");
registerCommands();
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskTimer(this, new SignCreationRequestTimeoutThread(signCreationRequests), 0L, 100L);