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
|
@ -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;
|
||||
|
|
Reference in a new issue