Skip to content

Commit

Permalink
perf: 重构包名
Browse files Browse the repository at this point in the history
  • Loading branch information
0XPYEX0 committed Jul 31, 2024
1 parent a1a57dd commit dddf31a
Show file tree
Hide file tree
Showing 19 changed files with 5,865 additions and 5,849 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'me.xpyex.plugin.xplib'
version = '1.1.5'
version = '1.1.6'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/xpyex/plugin/xplib/api/CommandMenu.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.xpyex.plugin.xplib.api;

import java.util.ArrayList;
import me.xpyex.plugin.xplib.util.strings.MsgUtil;
import me.xpyex.plugin.xplib.bukkit.strings.MsgUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.xpyex.plugin.xplib.api;

import java.util.ArrayList;
import me.xpyex.plugin.xplib.util.strings.MsgUtil;
import me.xpyex.plugin.xplib.bukkit.strings.MsgUtil;
import org.bukkit.command.CommandSender;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package me.xpyex.plugin.xplib;
package me.xpyex.plugin.xplib.bukkit;

import java.io.IOException;
import me.xpyex.plugin.xplib.core.XPPlugin;
import me.xpyex.plugin.xplib.bukkit.config.ConfigUtil;
import me.xpyex.plugin.xplib.bukkit.core.XPPlugin;
import me.xpyex.plugin.xplib.bukkit.inventory.HandleMenu;
import me.xpyex.plugin.xplib.bukkit.inventory.Menu;
import me.xpyex.plugin.xplib.bukkit.config.ConfigUtil;
import me.xpyex.plugin.xplib.bukkit.value.ValueCacheUtil;
import me.xpyex.plugin.xplib.util.files.FileUtil;
import me.xpyex.plugin.xplib.util.value.ValueCacheUtil;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.bukkit.version.VersionUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import me.xpyex.plugin.xplib.util.version.VersionUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import me.xpyex.plugin.xplib.bukkit.strings.MsgUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.files.FileUtil;
import me.xpyex.plugin.xplib.util.strings.MsgUtil;
import org.bukkit.plugin.Plugin;

public class ConfigUtil extends RootUtil {
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/me/xpyex/plugin/xplib/bukkit/config/GsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import me.xpyex.plugin.xplib.util.RootUtil;
Expand Down Expand Up @@ -111,4 +113,16 @@ public static Gson getGson() {
return GSON;
//
}

public static List<JsonElement> arrayAsList(JsonArray array) {
try {
return array.asList();
} catch (NoSuchMethodError e) {
List<JsonElement> list = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
list.add(array.get(i));
}
return list;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.xpyex.plugin.xplib.core;
package me.xpyex.plugin.xplib.bukkit.core;

import com.google.gson.JsonObject;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package me.xpyex.plugin.xplib.bukkit.inventory;

import java.util.ArrayList;
import me.xpyex.plugin.xplib.bukkit.strings.MsgUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.strings.MsgUtil;
import me.xpyex.plugin.xplib.util.strings.StrUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import org.bukkit.Material;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
import java.util.List;
import java.util.WeakHashMap;
import java.util.stream.Collectors;
import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.api.Pair;
import me.xpyex.plugin.xplib.core.XPPlugin;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.bukkit.config.ConfigUtil;
import me.xpyex.plugin.xplib.bukkit.config.GsonUtil;
import me.xpyex.plugin.xplib.bukkit.core.XPPlugin;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
Expand Down Expand Up @@ -72,7 +73,7 @@ public static List<String> getMessages(XPPlugin plugin, String key) {
Pair<JsonObject, String> pair = getFinalJsonObj(plugin, key);
if (pair != null) {
if (pair.getKey().has(pair.getValue())) {
return pair.getKey().get(pair.getValue()).getAsJsonArray().asList().stream().map(JsonElement::getAsString).collect(Collectors.toList());
return GsonUtil.arrayAsList(pair.getKey().get(pair.getValue()).getAsJsonArray()).stream().map(JsonElement::getAsString).collect(Collectors.toList());
}
}
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicReference;
import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.api.Pair;
import me.xpyex.plugin.xplib.api.TryCallable;
import me.xpyex.plugin.xplib.api.TryConsumer;
import me.xpyex.plugin.xplib.api.TryFunction;
import me.xpyex.plugin.xplib.api.TryRunnable;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.Contract;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package me.xpyex.plugin.xplib.util.strings;
package me.xpyex.plugin.xplib.bukkit.strings;

import com.google.gson.JsonObject;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.bukkit.config.ConfigUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package me.xpyex.plugin.xplib.util.strings;
package me.xpyex.plugin.xplib.bukkit.strings;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import java.io.File;
import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.bukkit.config.GsonUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.files.FileUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import org.bukkit.Material;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package me.xpyex.plugin.xplib.util.value;
package me.xpyex.plugin.xplib.bukkit.value;

import java.util.HashMap;
import java.util.Optional;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.xpyex.plugin.xplib.util.version;
package me.xpyex.plugin.xplib.bukkit.version;

import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.api.Version;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.util.RootUtil;
import org.bukkit.Bukkit;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/xpyex/plugin/xplib/util/tasks/TaskUtil.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.xpyex.plugin.xplib.util.tasks;

import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.api.TryCallable;
import me.xpyex.plugin.xplib.api.TryRunnable;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.bukkit.strings.MsgUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.util.strings.MsgUtil;
import me.xpyex.plugin.xplib.util.value.ValueUtil;

public class TaskUtil extends RootUtil {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/xpyex/plugin/xplib/util/value/ValueUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.api.TryCallable;
import me.xpyex.plugin.xplib.util.strings.MsgUtil;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.bukkit.strings.MsgUtil;
import org.jetbrains.annotations.NotNull;

public class ValueUtil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import me.xpyex.plugin.xplib.XPLib;
import me.xpyex.plugin.xplib.api.Version;
import me.xpyex.plugin.xplib.util.RootUtil;
import me.xpyex.plugin.xplib.bukkit.XPLib;
import me.xpyex.plugin.xplib.bukkit.config.GsonUtil;
import me.xpyex.plugin.xplib.util.RootUtil;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;

Expand Down
Loading

0 comments on commit dddf31a

Please sign in to comment.