Add dependency: LibAC
Remove compatibility with luckperms
This commit is contained in:
parent
5d024f425c
commit
00ea4681d8
20 changed files with 30 additions and 316 deletions
|
@ -12,10 +12,4 @@ If the mod becomes widely used, I will begin using deprecation notices.
|
|||
Compatibility
|
||||
=====
|
||||
|
||||
1) LuckPerms
|
||||
|
||||
LuckPerms is highly outdated for 1.18.2, but i have compiled a working version for forge. You can obtain it manually from https://github.com/zontreck/LuckPerms. Just check the release page for the latest update. There should not be any updates however, as the entire goal here is to only make it compatible with the latest forge version.
|
||||
|
||||
2) TBA
|
||||
|
||||
There will be at least one other mod that is compatible. This is to be announced at a later time.
|
||||
1) Lightman's Currency
|
16
build.gradle
16
build.gradle
|
@ -12,6 +12,11 @@ archivesBaseName = 'libzontreck'
|
|||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
configurations {
|
||||
provided
|
||||
compile.extendsFrom(provided)
|
||||
}
|
||||
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
minecraft {
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
|
@ -112,6 +117,11 @@ repositories {
|
|||
url = "https://cursemaven.com"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "zontreck Maven"
|
||||
url = "https://maven.zontreck.dev"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -132,6 +142,9 @@ dependencies {
|
|||
//runtimeOnly fg.deobf("curse.maven:luckperms-431733:3828099")
|
||||
//implementation fg.deobf("blank:LuckPerms:Forge-5.4.12")
|
||||
|
||||
provided "dev.zontreck:LibAC:1.1.1"
|
||||
implementation "dev.zontreck:LibAC:1.1.1"
|
||||
|
||||
// For more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
@ -139,6 +152,9 @@ dependencies {
|
|||
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
jar {
|
||||
from {
|
||||
configurations.provided.asFileTree.collect{zipTree(it)}
|
||||
}
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : project.name,
|
||||
|
|
|
@ -5,6 +5,6 @@ org.gradle.daemon=false
|
|||
|
||||
mc_version=1.18.2
|
||||
forge_version=40.2.1
|
||||
myversion=1.0.6.031820232016
|
||||
myversion=1.0.6.0420232221
|
||||
parchment_version=2022.11.06
|
||||
luckperms_api_version=5.4
|
|
@ -7,11 +7,11 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.zontreck.libzontreck.permissions.PermissionStorage;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.libzontreck.commands.Commands;
|
||||
import dev.zontreck.libzontreck.events.ForgeEventHandlers;
|
||||
import dev.zontreck.libzontreck.memory.VolatilePlayerStorage;
|
||||
|
@ -37,7 +37,7 @@ public class LibZontreck {
|
|||
public static final Map<String, Profile> PROFILES;
|
||||
public static MinecraftServer THE_SERVER;
|
||||
public static VolatilePlayerStorage playerStorage;
|
||||
public static boolean ALIVE;
|
||||
public static boolean ALIVE=true;
|
||||
public static final String FILESTORE = FileTreeDatastore.get();
|
||||
public static final Path BASE_CONFIG;
|
||||
public static final String PLAYER_INFO_URL = "https://api.mojang.com/users/profiles/minecraft/";
|
||||
|
@ -92,11 +92,7 @@ public class LibZontreck {
|
|||
public void onServerStopping(final ServerStoppingEvent ev)
|
||||
{
|
||||
ALIVE=false;
|
||||
try {
|
||||
PermissionStorage.save();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
DelayedExecutorService.stop();
|
||||
|
||||
Iterator<Profile> iProfile = PROFILES.values().iterator();
|
||||
while(iProfile.hasNext())
|
||||
|
@ -111,10 +107,10 @@ public class LibZontreck {
|
|||
public static class ClientModEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void onClientSetup(FMLClientSetupEvent ev)
|
||||
{
|
||||
public static void onClientSetup(FMLClientSetupEvent ev) {
|
||||
LibZontreck.CURRENT_SIDE = LogicalSide.CLIENT;
|
||||
LibZontreck.ALIVE=false; // Prevents loops on the client that are meant for server tick processing
|
||||
LibZontreck.ALIVE = false; // Prevents loops on the client that are meant for server tick processing
|
||||
|
||||
|
||||
//MenuScreens.register(ModMenuTypes.CHESTGUI.get(), ChestGuiScreen::new);
|
||||
}
|
||||
|
|
|
@ -5,13 +5,10 @@ import com.mojang.brigadier.arguments.StringArgumentType;
|
|||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import dev.zontreck.libzontreck.util.heads.HeadUtilities;
|
||||
import dev.zontreck.libzontreck.util.heads.HeadCache.HeadCacheItem;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.PlayerHeadItem;
|
||||
|
||||
public class GetHead {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatch)
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.zontreck.libzontreck.dynamicchest;
|
|||
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
public class ReadOnlyItemStackHandler extends ItemStackHandler
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package dev.zontreck.libzontreck.events;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package dev.zontreck.libzontreck.events;
|
||||
|
||||
import dev.zontreck.libzontreck.profiles.Profile;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public class ProfileUnloadedEvent extends Event
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.libzontreck.items.lore;
|
||||
package dev.zontreck.libzontreck.lore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
|
@ -1,11 +1,10 @@
|
|||
package dev.zontreck.libzontreck.items.lore;
|
||||
package dev.zontreck.libzontreck.lore;
|
||||
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.nbt.TagTypes;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class LoreContainer {
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.libzontreck.items.lore;
|
||||
package dev.zontreck.libzontreck.lore;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.zontreck.libzontreck.items.lore;
|
||||
package dev.zontreck.libzontreck.lore;
|
||||
|
||||
public enum LoreType {
|
||||
UNKNOWN((byte) 0x00),
|
|
@ -2,7 +2,6 @@ package dev.zontreck.libzontreck.networking.packets;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import dev.zontreck.libzontreck.networking.ModMessages;
|
||||
import dev.zontreck.libzontreck.util.BinUtil;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package dev.zontreck.libzontreck.permissions;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
public class Permission {
|
||||
public String permName;
|
||||
boolean isGroup(){
|
||||
return false;
|
||||
}
|
||||
|
||||
public Permission(String name){
|
||||
|
||||
this.permName = name;
|
||||
}
|
||||
|
||||
public CompoundTag save()
|
||||
{
|
||||
CompoundTag tag=new CompoundTag();
|
||||
tag.putString("name", permName);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public Permission(CompoundTag tag)
|
||||
{
|
||||
this(tag.getString("name"));
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package dev.zontreck.libzontreck.permissions;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.zontreck.libzontreck.LibZontreck;
|
||||
import dev.zontreck.libzontreck.util.FileTreeDatastore;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PermissionStorage extends FileTreeDatastore
|
||||
{
|
||||
public static final Path BASE = LibZontreck.BASE_CONFIG.resolve(
|
||||
"permissions.nbt");
|
||||
|
||||
private static final List<PermissionUser> permissionUsers;
|
||||
public static List<PermissionUser> getListOfUsers()
|
||||
{
|
||||
return Lists.newArrayList(permissionUsers);
|
||||
}
|
||||
|
||||
static{
|
||||
// Load the permission storage!
|
||||
List<PermissionUser> perms = new ArrayList<>();
|
||||
try {
|
||||
CompoundTag file = NbtIo.read(BASE.toFile());
|
||||
ListTag lst = file.getList("perms", Tag.TAG_COMPOUND);
|
||||
for (Tag tag :
|
||||
lst) {
|
||||
CompoundTag ct = (CompoundTag) tag;
|
||||
perms.add(new PermissionUser(ct));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
permissionUsers=perms;
|
||||
}
|
||||
|
||||
|
||||
public PermissionUser getUser(UUID user)
|
||||
{
|
||||
try{
|
||||
|
||||
return permissionUsers.stream()
|
||||
.filter(C->C.player.equals(user))
|
||||
.collect(Collectors.toList()).get(0);
|
||||
}catch(Exception e)
|
||||
{
|
||||
return new PermissionUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
public static void save() throws IOException {
|
||||
CompoundTag ct = new CompoundTag();
|
||||
ListTag tag = new ListTag();
|
||||
for (PermissionUser user :
|
||||
permissionUsers) {
|
||||
tag.add(user.save());
|
||||
}
|
||||
|
||||
ct.put("perms", tag);
|
||||
NbtIo.write(ct, BASE.toFile());
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package dev.zontreck.libzontreck.permissions;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PermissionUser {
|
||||
|
||||
public UUID player;
|
||||
public List<Permission> permissions = Lists.newArrayList();
|
||||
|
||||
public PermissionUser(Player player)
|
||||
{
|
||||
this(player.getUUID());
|
||||
}
|
||||
|
||||
public PermissionUser(UUID ID)
|
||||
{
|
||||
player=ID;
|
||||
}
|
||||
|
||||
public CompoundTag save()
|
||||
{
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putUUID("id", player);
|
||||
ListTag perms = new ListTag();
|
||||
for (Permission perm :
|
||||
permissions) {
|
||||
perms.add(perm.save());
|
||||
|
||||
}
|
||||
|
||||
tag.put("perms", perms);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public PermissionUser(CompoundTag tag)
|
||||
{
|
||||
player = tag.getUUID("id");
|
||||
|
||||
ListTag lst = tag.getList("perms", Tag.TAG_COMPOUND);
|
||||
for (Tag t :
|
||||
lst) {
|
||||
CompoundTag ct = (CompoundTag) t;
|
||||
permissions.add(new Permission(ct));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermission(String node)
|
||||
{
|
||||
return permissions.stream()
|
||||
.filter(CPRED-> CPRED.permName.equals(node))
|
||||
.count()>0;
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package dev.zontreck.libzontreck.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import dev.zontreck.libzontreck.LibZontreck;
|
||||
|
||||
|
||||
public class DelayedExecutorService {
|
||||
private static AtomicInteger COUNT = new AtomicInteger(0);
|
||||
private static final DelayedExecutorService inst;
|
||||
private static final Timer repeater;
|
||||
static{
|
||||
inst=new DelayedExecutorService();
|
||||
repeater=new Timer();
|
||||
repeater.schedule(new TimerTask(){
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
DelayedExecutorService.getInstance().onTick();
|
||||
|
||||
}
|
||||
}, 1000L, 1000L);
|
||||
}
|
||||
private DelayedExecutorService(){}
|
||||
|
||||
public static DelayedExecutorService getInstance()
|
||||
{
|
||||
return inst;
|
||||
}
|
||||
public class DelayedExecution
|
||||
{
|
||||
public DelayedExecution(Runnable run, long unix) {
|
||||
scheduled=run;
|
||||
unix_time=unix;
|
||||
}
|
||||
public Runnable scheduled;
|
||||
public long unix_time;
|
||||
}
|
||||
|
||||
public List<DelayedExecution> EXECUTORS = new ArrayList<>();
|
||||
|
||||
public void schedule(final Runnable run, int seconds)
|
||||
{
|
||||
if(!LibZontreck.ALIVE)return;
|
||||
//long unix = Instant.now().getEpochSecond()+ (seconds);
|
||||
TimerTask task = new TimerTask() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
run.run();
|
||||
}
|
||||
};
|
||||
repeater.schedule(task, seconds*1000L);
|
||||
//DelayedExecution exe = new DelayedExecution(run,unix);
|
||||
//EXECUTORS.add(exe);
|
||||
}
|
||||
|
||||
private static void stopRepeatingThread()
|
||||
{
|
||||
repeater.cancel();
|
||||
}
|
||||
|
||||
public void onTick()
|
||||
{
|
||||
if(!LibZontreck.ALIVE)
|
||||
{
|
||||
LibZontreck.LOGGER.info("Tearing down delayed executor service");
|
||||
DelayedExecutorService.stopRepeatingThread();
|
||||
return;
|
||||
}
|
||||
/*Iterator<DelayedExecution> it = EXECUTORS.iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
DelayedExecution e = it.next();
|
||||
if(e.unix_time < Instant.now().getEpochSecond())
|
||||
{
|
||||
it.remove();
|
||||
Thread tx = new Thread(e.scheduled);
|
||||
tx.setName("DelayedExecutorTask-"+String.valueOf(DelayedExecutorService.getNext()));
|
||||
tx.start();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static int getNext()
|
||||
{
|
||||
return COUNT.getAndIncrement();
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package dev.zontreck.libzontreck.util;
|
||||
|
||||
import dev.zontreck.libzontreck.permissions.PermissionStorage;
|
||||
import dev.zontreck.libzontreck.permissions.PermissionUser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionsWatchdog implements Runnable
|
||||
{
|
||||
public List<PermissionUser> perms;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(!perms.equals(PermissionStorage.getListOfUsers()))
|
||||
{
|
||||
try {
|
||||
PermissionStorage.save();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
perms = PermissionStorage.getListOfUsers();
|
||||
}
|
||||
|
||||
DelayedExecutorService.getInstance().schedule(this, 10);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package dev.zontreck.libzontreck.util.heads;
|
||||
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.items.lore.LoreContainer;
|
||||
import dev.zontreck.libzontreck.items.lore.LoreEntry;
|
||||
import dev.zontreck.libzontreck.lore.LoreContainer;
|
||||
import dev.zontreck.libzontreck.lore.LoreEntry;
|
||||
import dev.zontreck.libzontreck.util.heads.HeadCache.HeadCacheItem;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.zontreck.libzontreck.vectors;
|
|||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public class ChunkPos {
|
||||
public Points points;
|
||||
|
|
Reference in a new issue