Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Add Storage interface and LocalStorage object
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldieeins committed Jul 17, 2024
1 parent 339f855 commit 682d7fa
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>

<artifactId>application-main</artifactId>
<version>2024.7.1-beta.2</version>
<version>2024.7.1-beta.3</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ private boolean runUpdateCheck(JsonObject json) {
if (!v.equals(version)) {
NexusApplication.getLogger().debug("[RUNNER] The application is not up to date!");
return true;

}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private boolean updateModules() {
}

downloadModule("https://zyneonstudios.github.io/nexus-nex/zyndex/modules/official/nexus-minecraft-module.json",modules,disabledIds);
downloadModule("https://zyneonstudios.github.io/nexus-nex/zyndex/modules/official/zyneon-star-module.json",modules,disabledIds);
//TODO downloadModule("https://zyneonstudios.github.io/nexus-nex/zyndex/modules/official/zyneon-star-module.json",modules,disabledIds);

updated = true;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.zyneonstudios.application.utils;

import java.util.HashMap;
import java.util.UUID;

public class LocalStorage implements Storage {

private final UUID uuid;
private final HashMap<String, Object> map = new HashMap<>();

public LocalStorage(UUID uuid) {
this.uuid = uuid;
}

public LocalStorage() {
this.uuid = UUID.randomUUID();
}

@Override
public Object get(String path) {
return map.get(path);
}

@Override @Deprecated
public boolean getBool(String path) {
return getBoolean(path);
}

@Override
public Boolean getBoolean(String path) {
return (Boolean)map.get(path);
}

@Override @Deprecated
public double getDoub(String path) {
return getDouble(path);
}

@Override
public Double getDouble(String path) {
return (Double)map.get(path);
}

@Override @Deprecated
public int getInt(String path) {
return getInteger(path);
}

@Override
public Integer getInteger(String path) {
return (Integer)map.get(path);
}

@Override
public String getString(String path) {
return map.get(path).toString();
}

public UUID getUuid() {
return uuid;
}

public String getId() {
return uuid.toString();
}

public void delete(String path) {
map.remove(path);
}

public void clear() {
map.clear();
}

public void set(String path, Object value) {
delete(path);
map.put(path,value);
}

public void setBoolean(String path, boolean value) {
set(path,value);
}

public void setDouble(String path, double value) {
set(path,value);
}

public void setInteger(String path, int value) {
set(path,value);
}

public void setString(String path, String value) {
set(path,value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.zyneonstudios.application.utils;

public interface Storage {

default Object get(String path) {
return null;
}

default boolean getBool(String path) {
return false;
}

default Boolean getBoolean(String path) {
return null;
}

default double getDoub(String path) {
return -1;
}

default Double getDouble(String path) {
return null;
}

default int getInt(String path) {
return -1;
}

default Integer getInteger(String path) {
return null;
}

default String getString(String path) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function initLibrary(skipConnector) {
}
}
console.log("[CONNECTOR] init.library");
log(moduleId);
}

function optionExists(selectId, value) {
Expand Down
16 changes: 16 additions & 0 deletions application-ui/content/assets/cronos/css/app-menu-side.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ ul li.title p {

.side-menu.active .menu-panel p {
display: block;

a {
text-decoration: none;
color: var(--foreground2);
transition: all 0.25s ease;
}

a:hover {
cursor: pointer !important;
text-decoration: underline !important;
color: var(--accent2) !important;
}
}

.side-menu.active .menu-panel #panel-description {
color: var(--foreground2);
}

.submenu {
Expand Down

0 comments on commit 682d7fa

Please sign in to comment.