Skip to content

Commit

Permalink
update HSCore
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Oct 15, 2023
1 parent 1b177a6 commit 4068555
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 140 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<properties>
<java.version>1.8</java.version>
<core.version>4.3.14</core.version>
<core.version>4.3.15</core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/me/hsgamer/bettergui/api/menu/StandardMenu.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.hsgamer.bettergui.api.menu;

import me.hsgamer.bettergui.util.CaseInsensitivePathString;
import me.hsgamer.bettergui.util.PathStringUtil;
import me.hsgamer.hscore.collections.map.CaseInsensitiveStringMap;
import me.hsgamer.hscore.config.CaseInsensitivePathString;
import me.hsgamer.hscore.config.Config;
import me.hsgamer.hscore.config.PathString;

Expand Down Expand Up @@ -49,7 +48,7 @@ public abstract class StandardMenu extends Menu {
*/
protected StandardMenu(Config config) {
super(config);
Map<CaseInsensitivePathString, Object> configValues = PathStringUtil.asCaseInsensitiveMap(config.getNormalizedValues(false));
Map<CaseInsensitivePathString, Object> configValues = CaseInsensitivePathString.toCaseInsensitiveMap(config.getNormalizedValues(false));
Object rawMenuSettings = configValues.get(MENU_SETTINGS_PATH);
//noinspection unchecked
menuSettings = rawMenuSettings instanceof Map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import me.hsgamer.bettergui.action.ActionApplier;
import me.hsgamer.bettergui.api.argument.ArgumentProcessor;
import me.hsgamer.bettergui.api.menu.Menu;
import me.hsgamer.bettergui.util.PathStringUtil;
import me.hsgamer.bettergui.util.ProcessApplierConstants;
import me.hsgamer.hscore.collections.map.CaseInsensitiveStringHashMap;
import me.hsgamer.hscore.collections.map.CaseInsensitiveStringMap;
Expand All @@ -13,6 +12,7 @@
import me.hsgamer.hscore.common.StringReplacer;
import me.hsgamer.hscore.common.Validate;
import me.hsgamer.hscore.config.Config;
import me.hsgamer.hscore.config.PathString;

import java.math.BigDecimal;
import java.util.*;
Expand All @@ -39,7 +39,7 @@ public StoreArgumentProcessor(Menu menu) {
Config config = menu.getConfig();

ActionApplier tempMinArgActionApplier = new ActionApplier(Collections.emptyList());
for (Map.Entry<String, Object> entry : PathStringUtil.asStringMap(config.getNormalizedValues(false)).entrySet()) {
for (Map.Entry<String, Object> entry : PathString.toPathMap(config.getNormalizedValues(false)).entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (!key.equalsIgnoreCase("menu-settings")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import me.hsgamer.bettergui.BetterGUI;
import me.hsgamer.bettergui.builder.ConfigBuilder;
import me.hsgamer.bettergui.util.PathStringUtil;
import me.hsgamer.hscore.collections.map.CaseInsensitiveStringMap;
import me.hsgamer.hscore.config.PathString;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -83,7 +82,7 @@ private void setup(File file) {
ConfigBuilder.INSTANCE.build(file).ifPresent(config -> {
config.setup();
for (PathString pathString : config.getKeys(false)) {
Map<String, Object> values = PathStringUtil.asStringMap(config.getNormalizedValues(pathString, false));
Map<String, Object> values = PathString.toPathMap(config.getNormalizedValues(pathString, false));
String key = pathString.getLastPath();
if (includeMenuInTemplate) {
key = BetterGUI.getInstance().getMainConfig().getFileName(templateFolder, file) + "/" + key;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/hsgamer/bettergui/menu/AddonMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import me.hsgamer.bettergui.builder.ItemModifierBuilder;
import me.hsgamer.bettergui.downloader.AdditionalInfoKeys;
import me.hsgamer.bettergui.util.CaseInsensitivePathString;
import me.hsgamer.bettergui.util.StringReplacerApplier;
import me.hsgamer.hscore.bukkit.gui.event.BukkitClickEvent;
import me.hsgamer.hscore.bukkit.gui.object.BukkitItem;
import me.hsgamer.hscore.bukkit.item.BukkitItemBuilder;
import me.hsgamer.hscore.bukkit.utils.MessageUtils;
import me.hsgamer.hscore.config.CaseInsensitivePathString;
import me.hsgamer.hscore.config.Config;
import me.hsgamer.hscore.config.PathString;
import me.hsgamer.hscore.downloader.core.object.DownloadInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import me.hsgamer.bettergui.builder.ArgumentProcessorBuilder;
import me.hsgamer.bettergui.builder.InventoryBuilder;
import me.hsgamer.bettergui.requirement.RequirementApplier;
import me.hsgamer.bettergui.util.PlayerUtil;
import me.hsgamer.bettergui.util.ProcessApplierConstants;
import me.hsgamer.bettergui.util.StringReplacerApplier;
import me.hsgamer.hscore.bukkit.gui.BukkitGUIDisplay;
import me.hsgamer.hscore.bukkit.gui.BukkitGUIHolder;
import me.hsgamer.hscore.bukkit.scheduler.Scheduler;
import me.hsgamer.hscore.bukkit.scheduler.Task;
import me.hsgamer.hscore.bukkit.utils.MessageUtils;
import me.hsgamer.hscore.bukkit.utils.PermissionUtils;
import me.hsgamer.hscore.common.CollectionUtils;
import me.hsgamer.hscore.common.MapUtils;
import me.hsgamer.hscore.common.Pair;
Expand Down Expand Up @@ -240,7 +240,7 @@ public boolean create(Player player, String[] args, boolean bypass) {
refreshButtonMapOnCreate(buttonMap, uuid);

// Check Permission
if (!bypass && !PlayerUtil.hasAnyPermission(player, permissions)) {
if (!bypass && !PermissionUtils.hasAnyPermission(player, permissions)) {
MessageUtils.sendMessage(player, getInstance().getMessageConfig().getNoPermission());
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/me/hsgamer/bettergui/menu/PredicateMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import me.hsgamer.bettergui.argument.ArgumentHandler;
import me.hsgamer.bettergui.builder.ArgumentProcessorBuilder;
import me.hsgamer.bettergui.requirement.RequirementApplier;
import me.hsgamer.bettergui.util.PathStringUtil;
import me.hsgamer.bettergui.util.PlayerUtil;
import me.hsgamer.bettergui.util.ProcessApplierConstants;
import me.hsgamer.bettergui.util.StringReplacerApplier;
import me.hsgamer.hscore.bukkit.utils.PermissionUtils;
import me.hsgamer.hscore.collections.map.CaseInsensitiveStringMap;
import me.hsgamer.hscore.common.CollectionUtils;
import me.hsgamer.hscore.common.MapUtils;
import me.hsgamer.hscore.common.Pair;
import me.hsgamer.hscore.config.Config;
import me.hsgamer.hscore.config.PathString;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;

Expand Down Expand Up @@ -63,7 +63,7 @@ public PredicateMenu(Config config) {
return;
}

String name = PathStringUtil.asString(key.getPathString());
String name = PathString.toPath(key.getPathString());
//noinspection unchecked
Map<String, Object> values = new CaseInsensitiveStringMap<>((Map<String, Object>) value);
String menu = Objects.toString(values.get("menu"), null);
Expand All @@ -87,7 +87,7 @@ public boolean create(Player player, String[] args, boolean bypass) {
return false;
}

if (!bypass && !PlayerUtil.hasAnyPermission(player, permissions)) {
if (!bypass && !PermissionUtils.hasAnyPermission(player, permissions)) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/hsgamer/bettergui/menu/SimpleMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import me.hsgamer.bettergui.api.button.WrappedButton;
import me.hsgamer.bettergui.builder.ButtonBuilder;
import me.hsgamer.bettergui.util.CaseInsensitivePathString;
import me.hsgamer.bettergui.util.PathStringUtil;
import me.hsgamer.bettergui.util.SlotUtil;
import me.hsgamer.hscore.collections.map.CaseInsensitiveStringMap;
import me.hsgamer.hscore.config.CaseInsensitivePathString;
import me.hsgamer.hscore.config.Config;
import me.hsgamer.hscore.config.PathString;
import me.hsgamer.hscore.minecraft.gui.simple.SimpleButtonMap;

import java.util.Map;
Expand All @@ -21,7 +21,7 @@ public SimpleMenu(Config config) {
protected SimpleButtonMap createButtonMap() {
SimpleButtonMap buttonMap = new SimpleButtonMap();
for (Map.Entry<CaseInsensitivePathString, Object> entry : configSettings.entrySet()) {
String key = PathStringUtil.asString(entry.getKey().getPathString());
String key = PathString.toPath(entry.getKey().getPathString());
Object value = entry.getValue();
if (!(value instanceof Map)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import me.hsgamer.bettergui.api.requirement.BaseRequirement;
import me.hsgamer.bettergui.builder.RequirementBuilder;
import me.hsgamer.bettergui.util.PlayerUtil;
import me.hsgamer.bettergui.util.StringReplacerApplier;
import me.hsgamer.hscore.bukkit.utils.PermissionUtils;
import me.hsgamer.hscore.common.CollectionUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
Expand All @@ -29,7 +29,7 @@ protected Result checkConverted(UUID uuid, List<String> value) {
if (player == null) {
return Result.success();
}
if (value.stream().allMatch(s -> PlayerUtil.hasPermission(player, s))) {
if (value.stream().allMatch(s -> PermissionUtils.hasPermission(player, s))) {
return Result.success();
} else {
return Result.fail();
Expand Down

This file was deleted.

31 changes: 0 additions & 31 deletions src/main/java/me/hsgamer/bettergui/util/PathStringUtil.java

This file was deleted.

48 changes: 0 additions & 48 deletions src/main/java/me/hsgamer/bettergui/util/PlayerUtil.java

This file was deleted.

0 comments on commit 4068555

Please sign in to comment.